lock [Solved] Refresh element in model explorer

5 years 9 months ago - 5 years 9 months ago #2694 by jcantoniochamp
Hello,

After committing a name change of an Element via the java API, how can we refresh that element name in the model explorer to we can see the change?

I have so select the element in the model explorer to refresh the name.

Kind regards,

JClaude
The topic has been locked.
5 years 9 months ago - 5 years 9 months ago #2699 by barbe.rousse
The "refresh" should be done automatically without any other action ...
Could you share your code? Which version of Modelio are you using?
Your code should be something like
IModelingSession session = Modelio.getInstance().getModelingSession();
try( ITransaction transaction = session.createTransaction("Change name")){
	for (MObject element : selectedElements) {
                if (element instanceof ModelElement)
			((ModelElement) element).setName("test");
         }
	  transaction.commit();
}

Am I right?
The following user(s) said Thank You: jcantoniochamp
The topic has been locked.
5 years 9 months ago #2701 by jcantoniochamp
Dear Barbe Rousse,

Thanks. While pasting my code, I found out my mistake: the properties class was updating the name and not in the command: my bad.
Sorry for that.

Thanks,

JClaude
The topic has been locked.
Moderators: tmachmaab
Time to create page: 0.041 seconds
^ Back to Top