|
Re: [EMF.Edit] removeCommand [message #675479 is a reply to message #675409] |
Tue, 31 May 2011 16:24 |
smaoui asma Messages: 50 Registered: July 2009 Location: Paris Saclay, France |
Member |
|
|
Hello,
The problem comes from the fact that the node to remove is referenced by other classes in the same model.
in fact Command cmd= RemoveCommand.create(ed, gn); is the same than
Command cmd = new RemoveCommand(ed,gn.eContainer(),GGraphPackage.eINSTANCE.getGIMPLE_Graph_Nodes(),gn);
it removes only references betwwen the element and its container but did not check other references!!!!
when I removed manually the other references of the element to remove, The exception disappear and I can save my model.
I am wondering what is the role of the ItemProvider, the AdapterFactory, and other classes generated by EMF if we should remove manually all the references of the element to remove.
I think that I miss some thing. any idea ? should I call explicitly the adapters, notifychange,etc ?
thank you very much.
Asma
|
|
|
Re: [EMF.Edit] removeCommand [message #675495 is a reply to message #675479] |
Tue, 31 May 2011 16:40 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Asma,
It sounds like you want the effect of a DeleteCommand, which cleans up
all references using RemoveCommand and SetCommand, depending on
multiplicity.
charfi asma wrote:
> Hello,
>
> The problem comes from the fact that the node to remove is referenced
> by other classes in the same model. in fact Command cmd=
> RemoveCommand.create(ed, gn); is the same than
>
> Command cmd = new
> RemoveCommand(ed,gn.eContainer(),GGraphPackage.eINSTANCE.getGIMPLE_Graph_Nodes(),gn);
>
>
> it removes only references betwwen the element and its container but
> did not check other references!!!!
>
> when I removed manually the other references of the element to remove,
> The exception disappear and I can save my model.
>
> I am wondering what is the role of the ItemProvider, the
> AdapterFactory, and other classes generated by EMF if we should
> remove manually all the references of the element to remove.
> I think that I miss some thing. any idea ? should I call explicitly
> the adapters, notifychange,etc ?
>
> thank you very much.
>
> Asma
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.03046 seconds