Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Drag and Drop(Drag and drop over a selected element)
Drag and Drop [message #902169] Thu, 16 August 2012 04:26 Go to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 42
Registered: July 2012
Member
Hi,

As you can see in the figure below, I have task nodes ("A" and "B") and a link connecting between these two nodes.

Now, I wish to implement a drag and drop feature, for example if I drag another task node ("C") and drop in between the link between "A" and "B", final diagram will be like "A"-link-"C"-link-"B".

For this to happen, (I think) I need to catch the selection event of link "A" to "B" while I drag and moveover node "C". How this could be done? Any suggestions will be highly appreciated.


index.php/fa/11204/0/


Best Regards
Surya
  • Attachment: dragdrop.gif
    (Size: 7.69KB, Downloaded 225 times)
Re: Drag and Drop [message #902180 is a reply to message #902169] Thu, 16 August 2012 05:05 Go to previous messageGo to next message
Michael Wenz is currently offline Michael Wenz
Messages: 1524
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Surya,

in order to allow that operation, you need to define your own move feature
for your task shape and on canMove allow the drop onto the connection
(passed in via context.getTargetConnection).

In the move execution you will need to split up the existing connection into
two parts and add the moved shape as intermediate to the two new
connections.

Michael
Re: Drag and Drop [message #902215 is a reply to message #902180] Thu, 16 August 2012 08:04 Go to previous messageGo to next message
Surya Kathayat is currently offline Surya Kathayat
Messages: 42
Registered: July 2012
Member

Hi Michael,

Many thanks for the prompt response. Works fine if I drag a task node which is already in the editor. However it does not work if I select a task node from a Palette and drop to a link, any pointers?

index.php/fa/11205/0/

Best Regards
Surya
  • Attachment: dragdrop1.gif
    (Size: 14.80KB, Downloaded 209 times)
Re: Drag and Drop [message #902337 is a reply to message #902215] Fri, 17 August 2012 03:29 Go to previous messageGo to next message
Miriam Baran is currently offline Miriam Baran
Messages: 16
Registered: May 2012
Junior Member
Hi,
isn't this because you only modified the moveShapeFeature? If you select your node from Palette it will have to be the create and add Features you have to modify.
Re: Drag and Drop [message #903699 is a reply to message #902215] Mon, 20 August 2012 07:24 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1524
Registered: July 2009
Location: Walldorf, Germany
Senior Member
In that case your add feature will be triggered. There's also a
getTargetConnection method in the passed context.

Michael
Previous Topic:Custom Tooltips for Decorators
Next Topic:org.eclipse.swt.SWTException: Failed to execute runnable
Goto Forum:
  


Current Time: Wed Apr 16 00:31:50 EDT 2014

Powered by FUDForum. Page generated in 0.01816 seconds