Call rename element [message #1727059] |
Fri, 18 March 2016 13:56 |
Benoit Ries Messages: 86 Registered: May 2013 |
Member |
|
|
Hi,
I wish to rename programmatically an element in my model. For now I use a code similar to the one below.
The good thing is that it works, i.e. it renames the actor.
BUT unfortunately, all cross-references pointing to this element are NOT renamed.
- Maybe a first solution could be to perform a call to the "Rename Element" feature on my given EObject. But I have no clue on how to do that ?
- or any other solution that would notify the model that the EObject has been modified and forces the update of all its cross-references.
Any idea how I can call it directly do that ?
best regards,
Benoît
here is my current code:
IXtextDocument myDocument = XtextUtils.getXTextDocumentFromEObject(act);
myDocument.modify(new IUnitOfWork.Void<XtextResource>() {
@Override
public void process(XtextResource xtextResource) throws Exception {
PackageDeclaration pkg = (PackageDeclaration) xtextResource.getContents().get(0);
for (Actor actTmp: pkg.getEnvironmentM().getActors()) {
actTmp.setName(newName);
}}});
[Updated on: Mon, 21 March 2016 08:26] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01838 seconds