Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Passing data between ViewerDropAdapter and DragSourceListener
Passing data between ViewerDropAdapter and DragSourceListener [message #1691265] Sat, 04 April 2015 08:48 Go to next message
Cédric Moonen is currently offline Cédric MoonenFriend
Messages: 14
Registered: December 2014
Junior Member
Hello,

I implemented DnD in my application by imlementing DragSourceListener and extending ViewerDropAdapter. This works fine but in my application, the elements that are dragged have a multiplicity. In the drop() method, I display a dialog to the user asking him how many elements have to be moved.

I would like to pass this number from my ViewerDropAdapter towards my DragSourceListener, since I would like the DragSourceListener to implement the remove of the elements in the source widget.

I currently implement everything in my ViewerDropAdapter, but this is growing more and more complex between I can have multiple sources for the elements to be dragged and several targets as well. Decoupling the drag behavior from the drop behavior would help a lot in reducing the complexity (this would avoir having to handle all combination of sources and targets).

I though that this would be feasible by passing some custom data in the event but apparently this is not the case (there's no field for custom data).

Any idea how I can implement this?

Thanks,
Cédric
Re: Passing data between ViewerDropAdapter and DragSourceListener [message #1691322 is a reply to message #1691265] Sun, 05 April 2015 23:48 Go to previous messageGo to next message
Eclipse UserFriend
I would use the LocalSelectionTransfer and transfer a custom object in which you place this multiplicity information or whatever else is needed.

Brian.
Re: Passing data between ViewerDropAdapter and DragSourceListener [message #1691340 is a reply to message #1691322] Mon, 06 April 2015 08:48 Go to previous messageGo to next message
Cédric Moonen is currently offline Cédric MoonenFriend
Messages: 14
Registered: December 2014
Junior Member
Hi Brian,

Thanks for the reply. I actually solve my problem another way: I extended LocaSelectionTransfer to have an additional quantity field. This seems to work fine as well.

Thanks,
Cédric
Re: Passing data between ViewerDropAdapter and DragSourceListener [message #1691355 is a reply to message #1691340] Mon, 06 April 2015 13:40 Go to previous message
Eclipse UserFriend
That's fine as long as you're prepare to maintain your parallel branch. It's not a very maintainable solution, IMHO. Creating your own ISelection is a much better solution long-term.

Brian.
Previous Topic:TreeViewer with ILazyTreeContentProvider
Next Topic:Single Selection ViewerProperties Databinding with Converter
Goto Forum:
  


Current Time: Fri Apr 19 03:22:12 GMT 2024

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

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

Back to the top