org.eclipse.emf.edit.ui.dnd
Class ViewerDragAdapter

java.lang.Object
  extended by org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter
All Implemented Interfaces:
EventListener, org.eclipse.swt.dnd.DragSourceListener, org.eclipse.swt.internal.SWTEventListener

public class ViewerDragAdapter
extends Object
implements org.eclipse.swt.dnd.DragSourceListener

This is an implementation of 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.


Constructor Summary
ViewerDragAdapter(org.eclipse.jface.viewers.Viewer viewer)
          This creates an instance for the given viewer.
 
Method Summary
 void dragFinished(org.eclipse.swt.dnd.DragSourceEvent event)
          This is called when dragging is completed; it forgets the selection.
 void dragSetData(org.eclipse.swt.dnd.DragSourceEvent event)
          This is called to transfer the data.
 void dragStart(org.eclipse.swt.dnd.DragSourceEvent event)
          This is called when dragging is initiated; it records the selection of viewer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewerDragAdapter

public ViewerDragAdapter(org.eclipse.jface.viewers.Viewer viewer)
This creates an instance for the given viewer.

Method Detail

dragStart

public void dragStart(org.eclipse.swt.dnd.DragSourceEvent event)
This is called when dragging is initiated; it records the selection of viewer.

Specified by:
dragStart in interface org.eclipse.swt.dnd.DragSourceListener

dragFinished

public void dragFinished(org.eclipse.swt.dnd.DragSourceEvent event)
This is called when dragging is completed; it forgets the selection.

Specified by:
dragFinished in interface org.eclipse.swt.dnd.DragSourceListener

dragSetData

public void dragSetData(org.eclipse.swt.dnd.DragSourceEvent event)
This is called to transfer the data.

Specified by:
dragSetData in interface org.eclipse.swt.dnd.DragSourceListener


Copyright © 2014. All Rights Reserved.