Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] EMF transaction for inserting a new Element in a diagram

Hi all,

First, thanks a lot for your previous answers concerning how to get a "Comment" instance from the active editor. This works as expected.

My new question concerns the adding of a Comment or a NamedElement such as a CallBehaviour for example in an active activity diagram through an emf transaction.

I would use the following skeleton for example:

// we suppose we have access to the serviceRegistry instance
TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
domain
.getCommandStack().execute(new RecordingCommand(domain) {
   
public void doExecute() {
       
// do the changes here
   
}
}

I have downloaded your Papyrus source code. However I have no idea where to search an example for adding an Element in the active editor or some code that might help me?
I have grep "RecordingCommand" but I found a lot of occurences with some "@generated code" comments. Thus I decided to ask for some help.

How to deal with my need ?


Thanks


-- 
Alexandre HERISSE
Xcos developer
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.70
http://www.scilab-enterprises.com 

Back to the top