Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to know when a connection is moved (not reconnected)
How to know when a connection is moved (not reconnected) [message #148039] Tue, 28 August 2007 08:23 Go to next message
Eclipse UserFriend
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
Marc Gil is currently offline Marc GilFriend
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
Previous Topic:Creating A Bi-Directional Referenced Based Link
Next Topic:create a child element when an attribute of the parent is set ...
Goto Forum:
  


Current Time: Mon Jul 22 22:26:35 GMT 2024

Powered by FUDForum. Page generated in 0.03493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top