|
Re: EMF transaction for inserting a new Element in a diagram [message #1048457 is a reply to message #1048264] |
Wed, 24 April 2013 13:47 |
|
Hi, Alexandre,
Many (most?) such editing actions in Papyrus don't execute
RecordingCommands on the CommandStack but AbstractEMFOperations on the
IOperationHistory. They can be added to context menus using the
org.eclipse.ui.menus extension point, together with command handlers.
For an example, you might look at how the Add Child menu is implemented
in the Model Explorer.
HTH,
Christian
On 2013-04-24 12:48:39 +0000, HERISSE Alexandre said:
> My 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
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02492 seconds