Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Send a Drag and Drop between 2 node (from a Tree)(Dnd, Drag and Drop, Tree, Node)
Send a Drag and Drop between 2 node (from a Tree) [message #1774178] Wed, 11 October 2017 10:21 Go to next message
Antoine Omnès is currently offline Antoine OmnèsFriend
Messages: 11
Registered: September 2017
Junior Member
Hi everyone,

I would like to know if it is possible to use a drag and drop to drop an object between to node (from a Tree)?

And if it is possible, could you put an example here.

+ Item
--- drop here ---
+ Item

Thanks,
Antoine
Re: Send a Drag and Drop between 2 node (from a Tree) [message #1774186 is a reply to message #1774178] Wed, 11 October 2017 12:44 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 53
Registered: July 2009
Member
Hi Antoine,

Yes, you should be able to drag and drop almost any SWTBot widget onto another, for example:

SWTBotTreeItem source = ...
SWTBotTreeItem target = ...
source.dragAndDrop(target);

It currently does not support changing the drop operation (copy, move, link), or setting the xy-coordinates (it drags from center of source and drops to center of target).

Of course your SWT application must have implemented DND support first, either directly or through an extension point (for example in a CommonNavigator).

Adding Drag and Drop to an SWT Application

Navigator Content - dropAssistant

Patrick
Re: Send a Drag and Drop between 2 node (from a Tree) [message #1774190 is a reply to message #1774186] Wed, 11 October 2017 13:19 Go to previous messageGo to next message
Antoine Omnès is currently offline Antoine OmnèsFriend
Messages: 11
Registered: September 2017
Junior Member
Hi Patrick,

Thank you for you response.

Yes, I have already DnD in my application.

I would like to do that.
https://i.stack.imgur.com/gVRzS.png
And for now I know only how to do that...
https://i.stack.imgur.com/Etdsl.png

With:
SWTBotTreeItem source = ...
SWTBotTreeItem target = ...
source.dragAndDrop(target);

Antoine
Re: Send a Drag and Drop between 2 node (from a Tree) [message #1774194 is a reply to message #1774190] Wed, 11 October 2017 13:54 Go to previous message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 53
Registered: July 2009
Member
Oh, sorry, I misunderstood your question... I thought you were suggesting the location where I should drop my source code example ;)

My guess is that the functionality to 'insert' a dropped tree item is something that is implemented in the application based on the xy-coordinates of the DND events.

This would probably require a new method in AbstractSWTBot where the user could provide the specific xy-coordinates to be used.

If such a method is added, it should probably include parameters for the source coordinates (relative to its parent), the target coordinates (relative to display) and the drop operation.

If you would like to contribute a patch for this, we can review it and consider it for the next release.

Patrick
Previous Topic:How to modify Tree/table?
Next Topic:SWTBot command line, my test doesn't start
Goto Forum:
  


Current Time: Wed Sep 19 16:25:15 GMT 2018

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

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

Back to the top