|
Re: Manipulate Notational Model on Element Creation [message #660652 is a reply to message #660579] |
Sun, 20 March 2011 16:49 |
Christophe Bouhier Messages: 937 Registered: July 2009 |
Senior Member |
|
|
On 19-03-11 08:45, ralph. wrote:
> Hi all,
>
> I want to set a value in the notational model when adding an editpart to
> the diagram.
Hi, you could modify the ViewProvider (in package xxx.yyy.providers).
This is the place where initial views of the Notation model are populated.
I added the following code in the add Notify of the
It's generally not a good idea to let editparts create commands.
A better place is edit policies. (Edit parts, actually delegate
getCommand(request) to all installed editing policies.
> editpart. This code throes an exception saying that I am in a read only
> transaction.
Is there a way to get around this? Set values in the
> notational model, by using a Initializer in the gmfmap?
I believe the initializers are meant for the semantic model, the
ViewProvider is your best bet. BTW, if you don't want to mess with the
original ViewProvider, just copy it to a new plugin, and copy the view
provider declaration from the plugin.xml to the new plugin.xml and
change the priority to a higher level. Modify the ViewProvider at wish.
>
>
> EditingDomain domain = getEditingDomain();
> Command cmd = SetCommand.create(domain, getNotationView(),
> NotationPackage.eINSTANCE.getView_Visible(), false);
> getEditingDomain().getCommandStack().execute(cmd);
>
>
> Ralph
|
|
|
|
Powered by
FUDForum. Page generated in 0.02465 seconds