public class ViewerDragAdapter
extends java.lang.Object
DragSourceListener
.
It allows the selection in effect at the start of the drag and drop interaction to be recorded,
which is especially important for a drag and drop interaction within a single view.
This is how one of these adapters is typically hooked up:
viewer.addDragSupport (DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK, new Transfer [] { LocalTransfer.getInstance() }, ViewerDragAdapter(viewer));Doing so simply allows a drag operation to be initiated from the viewer such that the viewer's selection is transferred to the drop target. See
EditingDomainViewerDropAdapter
and LocalTransfer
for more details.
As of EMF 2.9, LocalSelectionTransfer
is also supported;
this is preferred because it's used by the platform's explorers.Modifier and Type | Field and Description |
---|---|
protected ISelection |
selection
This keeps track of the selection that is in effect at the start of the drag operation
|
protected Viewer |
viewer
This keeps track of the viewer to which we are listening.
|
Constructor and Description |
---|
ViewerDragAdapter(Viewer viewer)
This creates an instance for the given viewer.
|
Modifier and Type | Method and Description |
---|---|
void |
dragFinished(DragSourceEvent event)
This is called when dragging is completed; it forgets the
selection . |
void |
dragSetData(DragSourceEvent event)
This is called to transfer the data.
|
void |
dragStart(DragSourceEvent event)
|
protected Viewer viewer
protected ISelection selection
public ViewerDragAdapter(Viewer viewer)
public void dragStart(DragSourceEvent event)
public void dragFinished(DragSourceEvent event)
selection
.public void dragSetData(DragSourceEvent event)