net.refractions.udig.ui
Class UDIGDragDropUtilities

java.lang.Object
  extended by net.refractions.udig.ui.UDIGDragDropUtilities

public class UDIGDragDropUtilities
extends java.lang.Object

Useful methods for adding drag and drop support to controls or viewers. It hooks up the control with the udig drag and drop framework.

Author:
jones

Nested Class Summary
static class UDIGDragDropUtilities.DragSourceDescriptor
           
static class UDIGDragDropUtilities.DropTargetDescriptor
           
 
Constructor Summary
UDIGDragDropUtilities()
           
 
Method Summary
static void addDragDropSupport(Control control, IDropTargetProvider destination, ISelectionProvider source)
          Adds both drag and drop support to the StructuredViewer.
static void addDragDropSupport(StructuredViewer viewer, IDropTargetProvider defaultTarget)
          Adds both drag and drop support to the StructuredViewer.
static void addDragDropSupport(StructuredViewer viewer, IDropTargetProvider defaultTarget, boolean showDropFeedback, boolean expandTree)
          Adds both drag and drop support to the StructuredViewer.
static UDIGDragDropUtilities.DragSourceDescriptor addDragSupport(Control control, ISelectionProvider provider)
          Adds drag support to the StructuredViewer.
static UDIGDropTargetListener addDropSupport(StructuredViewer viewer, IDropTargetProvider defaultTarget)
          Adds drop support to the StructuredViewer.
static UDIGDropTargetListener addDropSupport(StructuredViewer viewer, IDropTargetProvider defaultTarget, boolean showDropFeedback, boolean scrollExpandEnabled)
          Adds drop support to the StructuredViewer.
static UDIGControlDropListener getEditorDropListener()
          Creates a drop listener that will send the drop event to the currently active editor.
static java.util.Set<Transfer> getTransfers()
          Returns the transfers that are available with the current udig configuration.
static void registerUDigDND(IWorkbenchWindowConfigurer configurer)
          Registers the DND Support needed by uDig.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UDIGDragDropUtilities

public UDIGDragDropUtilities()
Method Detail

addDragDropSupport

public static void addDragDropSupport(StructuredViewer viewer,
                                      IDropTargetProvider defaultTarget)
Adds both drag and drop support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Feedback is enabled but scroll and expand is not.

Parameters:
viewer - the viewer to have drag and drop support added to it.
defaultTarget - The target to use if the mouse is not over an item in the viewer

addDragDropSupport

public static void addDragDropSupport(StructuredViewer viewer,
                                      IDropTargetProvider defaultTarget,
                                      boolean showDropFeedback,
                                      boolean expandTree)
Adds both drag and drop support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Parameters:
viewer - the viewer to have drag and drop support added to it.
defaultTarget - The target to use if the mouse is not over an item in the viewer

addDropSupport

public static UDIGDropTargetListener addDropSupport(StructuredViewer viewer,
                                                    IDropTargetProvider defaultTarget)
Adds drop support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Feedback is enabled but scroll and expand is not.

Parameters:
viewer - the viewer to have drop support added to it.
destination - The target to use if the mouse is not over an item in the viewer

addDropSupport

public static UDIGDropTargetListener addDropSupport(StructuredViewer viewer,
                                                    IDropTargetProvider defaultTarget,
                                                    boolean showDropFeedback,
                                                    boolean scrollExpandEnabled)
Adds drop support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Parameters:
viewer - the viewer to have drop support added to it.
destination - The target to use if the mouse is not over an item in the viewer
showDropFeedback - if true the feedback bars will be shown in the viewer.
scrollExpandEnabled - if true trees will be expanded and the viewer will be scrolled.

addDragDropSupport

public static void addDragDropSupport(Control control,
                                      IDropTargetProvider destination,
                                      ISelectionProvider source)
Adds both drag and drop support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Parameters:
control - the viewer to have drag and drop support added to it.
destination - the destination that determines what actions will take place when a drag or drop event occurs.

addDragSupport

public static UDIGDragDropUtilities.DragSourceDescriptor addDragSupport(Control control,
                                                                        ISelectionProvider provider)
Adds drag support to the StructuredViewer.

For this to work the destination object must have a dropAction extension defined for it.

Parameters:
control - the viewer to have drag support added to it.
destination - the destination that determines what actions will take place when a drag event occurs.
Returns:

getTransfers

public static java.util.Set<Transfer> getTransfers()
Returns the transfers that are available with the current udig configuration.

Returns:
the transfers that are available with the current udig configuration.

registerUDigDND

public static void registerUDigDND(IWorkbenchWindowConfigurer configurer)
Registers the DND Support needed by uDig. Public because it might need to be called by another application using uDig as a plugin.

Parameters:
configurer - The IWorkbenchWindowConfigurer for the workbench

getEditorDropListener

public static UDIGControlDropListener getEditorDropListener()
Creates a drop listener that will send the drop event to the currently active editor.

Returns:
a drop listener that will send the drop event to the currently active editor.