Programmatically update diagrams + write transaction [message #1106640] |
Wed, 11 September 2013 07:00  |
Eclipse User |
|
|
|
Hi.
I am working on refactorings for UML models triggered from whithin the context menu of a graphical UML model element in Papyrus (e.g., an operation 'foo()').
There are (so far) two problems with this:
1. If I move the element (e.g., operation 'foo()') to another class (e.g., by using refactoring 'PullUpOperation') using the UML API, the corresponding diagram is not updated. Is there a way to force this update programmatically?
2. If I add a new element (e.g., a parameter 'bar' to operation 'foo()') using the UML API, I get an exception 'cannot modify resource set without a write transaction'. I found out that Papyrus uses a read-only editing domain (PapyrusROTransactionalEditingDomain). Does this mean that the UML model can not be modified by inserting new elements programmatically?
Best regards,
Thorsten
|
|
|
Re: Programmatically update diagrams + write transaction [message #1109974 is a reply to message #1106640] |
Mon, 16 September 2013 03:38  |
Eclipse User |
|
|
|
Hi,
Quote:I found out that Papyrus uses a read-only editing domain (PapyrusROTransactionalEditingDomain).
Actually, the name of this class is not really accurrate. It is actually an EditingDomain which also has support for Read-only resources.
The main issue, in your case, is that it is Transactional. You need to start a transaction before you can actually start modifying the model. For example:
Command command = ...; //An EMF Edit Command
editingDomain.getCommandStack().execute(command); //The command stack handles the transaction
Regards,
Camille
|
|
|
Powered by
FUDForum. Page generated in 0.03167 seconds