The easiest way is to use LocalSelectionTransfer
. Once you have added drag and drop support to your viewers ...
You set the ISelection
, which is dragged into the DragSourceListener.dragStart()
method:
LocalSelectionTransfer.getTransfer().setSelection(selection);
In DropTargetListener.drop()
you check if the type is supported and if the selection is retrieved:
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) ISelection sel = LocalSelectionTransfer.getTransfer().getSelection(); ...
source share