Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Get and modify elements marked in outline
Get and modify elements marked in outline [message #1033679] Thu, 04 April 2013 14:08 Go to next message
Maximilian Girlich is currently offline Maximilian GirlichFriend
Messages: 17
Registered: March 2013
Junior Member
Hey,

this is probably very simple but as a beginner I haven't found an answer yet. I want to add the following feature to my editor: One marks some elements there, right clicks a box comes up where one can type a name and then the elements get automatically renamed following a certain structure.

So I add an event for the outline and from there I have to access the elements marked.

Now, my problem is how do I get the elements marked in the outline?

Thanks for your help and regards,
Maximilian
Re: Get and modify elements marked in outline [message #1033709 is a reply to message #1033679] Thu, 04 April 2013 14:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
http://www.eclipse.org/forums/index.php/m/1010579/?srch=EObjectNode#msg_1010579

but why dont you simply reuse the existing rename feature


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Get and modify elements marked in outline [message #1037211 is a reply to message #1033679] Tue, 09 April 2013 09:45 Go to previous message
Maximilian Girlich is currently offline Maximilian GirlichFriend
Messages: 17
Registered: March 2013
Junior Member
Do you mean the "DefaultRenameHandler" by the existing rename feature? If so, I tried to reuse code from it but then get a "discouraged access" warning. Seemingly, I'm doing something wrong...

I managed to get which elements in the outline i.e. which EObjectNodes are selected. But how can I tell Xtext to refactor them? During my search with google I found something but again I get the "discouraged access" warnings:

private void performDirectRenameRefactoring(EObject object, String newName) throws InterruptedException {
	    XtextEditor editor = EditorUtils.getActiveXtextEditor();
	    IRenameElementContext renameContext = new IRenameElementContext.Impl(
	        EcoreUtil.getURI(object),
	        object.eClass(),
	        editor,
	        editor.getSelectionProvider().getSelection(),
	        null);
	    IRenameSupport rename = renameSupportFactory.create(renameContext, newName);
//	    renameSupport.
	    rename.startDirectRefactoring();
	}
Previous Topic:GraphView style grammar breaks in Xtext 2.4
Next Topic:Xtext grammar repository?
Goto Forum:
  


Current Time: Fri Mar 29 15:10:50 GMT 2024

Powered by FUDForum. Page generated in 0.02362 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top