Change value of a model element on deleting connection [message #143558] |
Fri, 20 July 2007 04:16  |
Eclipse User |
|
|
|
Hi !
I want to update a model value when I delete a connection from my
diagram. I thought that I could do that on the
ConnectionItemSemanticEditPolicy.getDestroyElementCommand(.. ) but this
method is called when I select the connection on the graph, when I
delete the connection, and when I create a connection.
Is there a way to know if the connection will be deleted and not
selected/created ?
Thanks in advance
|
|
|
Re: Change value of a model element on deleting connection [message #143576 is a reply to message #143558] |
Fri, 20 July 2007 08:18  |
Eclipse User |
|
|
|
Hi Julien,
This method is apparently called in all these situations to update
enablement of the associated action. Your update should be a part of the
command you return. This way, it will be executed only when the
connection is actually deleted from the diagram.
Note that if the connection is deleted by other means (e.g.,
programmatically), this command may not be executed. If you really need
to make sure any deletion of this type of connection should update the
model, you should subscribe to your (transactional) editing domain with
a precommit ResourceSetListener and contribute your trigger command from
transactionAboutToCommit(...) method.
Best regards,
Boris
Julien Forot wrote:
> Hi !
>
> I want to update a model value when I delete a connection from my
> diagram. I thought that I could do that on the
> ConnectionItemSemanticEditPolicy.getDestroyElementCommand(.. ) but this
> method is called when I select the connection on the graph, when I
> delete the connection, and when I create a connection.
>
> Is there a way to know if the connection will be deleted and not
> selected/created ?
>
> Thanks in advance
|
|
|
Powered by
FUDForum. Page generated in 0.04806 seconds