Get and modify elements marked in outline [message #1033679] |
Thu, 04 April 2013 10:08  |
Eclipse User |
|
|
|
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 #1037211 is a reply to message #1033679] |
Tue, 09 April 2013 05:45  |
Eclipse User |
|
|
|
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();
}
|
|
|
Powered by
FUDForum. Page generated in 0.26107 seconds