Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Drag a node and drop on connection(Drag a node edit part and drop on a connection...)
Drag a node and drop on connection [message #633400] Sun, 17 October 2010 13:07 Go to next message
amay is currently offline amayFriend
Messages: 13
Registered: July 2009
Junior Member
Hello,
I have my graphical editor, I want following behavior:

When user drag a graphical node and drop on some other connection, the connection should be updated with dropped node.

For example, node 'A' and 'B' are connected by a connection
'A' -> 'B'
now I drag a node 'C' and drop on the connection, then the new relation should be...
'A'->'C'->'B'

Can anyone please help me what edit policies or something else shall I use to achieve this behavior??

Thank you,
Amay.
Re: Drag a node and drop on connection [message #634982 is a reply to message #633400] Mon, 25 October 2010 10:12 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 313
Registered: July 2009
Senior Member
On 17.10.10 15:07, amay wrote:
> When user drag a graphical node and drop on some other connection, the
> connection should be updated with dropped node.

> Can anyone please help me what edit policies or something else shall I
> use to achieve this behavior??

This is a tricky thing to implement. What you need to to is to implement
a whole bunch of classes, as what you want to do is to replace the
standard selection edit policy, which works a little bit different then
simple creation tools. I don't have the time to give you a whole
instruction about that, but here are some hints. You'd need

- a subclass of AbstractDecoratorEditPolicy installed at the
parent edit part in order to install the following
policy at its children
- a subclass of ResizableEditPolicy(Ex) (the Ex is a GMF class,
have a look at the code, it adds drag and drop capabilities),
creating new handles (see below) and optionally a new
feedback figure
- a subclass of MoveHandle creating a new drag tracker (see below)
- optionally feedback figure, in order to let the user distinguish
between move and your operation
- a subclass of SelectionTool, creating a new tracker (see below)
- a subclass of DragEditPartsTracker, creating a new request
(see below), and also creates the command (see DragEditPartsTracker
to get an idea).
- a subclass of ChangeBoundsRequest, this request is eventually send
to your ResizableEditPolicy, which can distinguish between "standard"
move and your move by checking the request class

Maybe there exist easier solutions (suggestions are welcome). Sorry for
the brief answer, I hope it gives you a rough idea.

Cheers,
Jens
Re: Drag a node and drop on connection [message #634985 is a reply to message #634982] Mon, 25 October 2010 10:44 Go to previous message
amay is currently offline amayFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks Jens for giving me the brief idea. It seems the task it very tricky. I will give it a try but not sure.
Please let me know if you have any easier idea for doing the same thing.

Thanks,
Amay.
Previous Topic:ConnectionDragCreationTool does not show feedback
Next Topic:... delete this post ...
Goto Forum:
  


Current Time: Tue Apr 16 10:44:24 GMT 2024

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

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

Back to the top