Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Programmatically update diagrams + write transaction
Programmatically update diagrams + write transaction [message #1106640] Wed, 11 September 2013 11:00 Go to next message
Thorsten Arendt is currently offline Thorsten Arendt
Messages: 11
Registered: June 2013
Junior Member
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 07:38 Go to previous message
Camille Letavernier is currently offline Camille Letavernier
Messages: 476
Registered: February 2011
Senior Member
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


Camille Letavernier
Papyrus developer
Previous Topic:extending requirement diagram in SysML
Next Topic:Wrist guard and Action menu
Goto Forum:
  


Current Time: Wed Oct 22 12:24:30 GMT 2014

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

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