How to know when a connection is moved (not reconnected) [message #148039] |
Tue, 28 August 2007 08:23 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: gmerin.integranova.com
Hi everyone!
I am working in a graphical editor that needs to know when a connection
is moved. The truth is that I need to know when one of the ends (or
both) of the connection is moved because something must be done in
function of the new position of the ends (I must update some properties
of other model elements).
If anyone needs more information, what I am really trying to do is to
order the elements that are represented by the connections in the model
file. Each element (represented by the connection) creates an ordering
element when are created (with the properties before and after). So, if
a connection is moved, I must check its position and make the changes in
the ordering elements.
Any help would be appreciated.
Thanks in advance.
Gabriel.
|
|
|
Re: How to know when a connection is moved (not reconnected) [message #148107 is a reply to message #148039] |
Tue, 28 August 2007 16:26 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Marc Gil![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=marcgise%40gmail.com) Messages: 81 Registered: July 2009 |
Member |
|
|
Hi Gabi, I think I know how to do it, because I do it in my own project ;)
Well, you must to go to your *.diagram.edit.commands folder, and here you
will find all the classes that represents the creation and reorder events
of a connection, named for example "ProjectWofkpackageCreateCommand" and
"ProjectWorkpackageReorientCommand" (you know what I'm saying :D )
Into the Reorient Class, you will find several methods that helps to do
what you want:
- 'canExecute' checks if a reorientation is allowed.
- 'canReorientSource' checks if the source of the relation can be
reoriented.
- 'canReorientTarget' checks the same, but for the target.
- 'doExecuteWithResult', is the main method who reorients the relation. It
calls to 'reorientSource' and 'reorientTarget' to do it.
You also will find several methods that help you to know which is is the
old element and the new one (getOldSource, getOldTarget, getNewSource and
getNewTarget).
I hope it's what you're finding ;)
Salut!
Marc
|
|
|
Powered by
FUDForum. Page generated in 0.03968 seconds