net.refractions.udig.ui
Class IDropAction

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

public abstract class IDropAction
extends java.lang.Object

Defines the behaviour when a drag and drop event occurs. The extension declaration combined with the accepts method determines whether the Action will be ran for a given drag/drop event.

If the enablesFor is a anything other than null or 1 then an array of objects (all the same type) will be the data returned by getData, otherwise the data be a single object (not an array).

Since:
1.0.0
Author:
jdeolive

Field Summary
static java.lang.String XPID
           
 
Constructor Summary
IDropAction()
           
 
Method Summary
abstract  boolean accept()
          Called if the action seems to be a good candidate for handling the drop event.
 java.lang.Object getData()
          Returns the dropped data.
 java.lang.Object getDestination()
          Returns the object that the data was dropped on.
 IConfigurationElement getElement()
          Returns the Configuration element that definates the action in the extension declaration.
 DropTargetEvent getEvent()
          The drop event.
 java.lang.String getName()
          Returns the name of the action.
 ViewerDropLocation getViewerLocation()
          This does not always make sense for the drop event.
 void init(IConfigurationElement element2, DropTargetEvent event2, ViewerDropLocation location2, java.lang.Object destination2, java.lang.Object data2)
          Called by framework to initialize the action.
abstract  void perform(IProgressMonitor monitor)
          Performs the drop action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPID

public static final java.lang.String XPID
See Also:
Constant Field Values
Constructor Detail

IDropAction

public IDropAction()
Method Detail

getElement

public IConfigurationElement getElement()
Returns the Configuration element that definates the action in the extension declaration.

Returns:
the Configuration element that definates the action in the extension declaration.

getName

public java.lang.String getName()
Returns the name of the action.

Returns:
Returns the name of the action.

accept

public abstract boolean accept()
Called if the action seems to be a good candidate for handling the drop event.

Returns:
true if the action this it should handle the drop event.
See Also:
getData();, getData(), getEvent()

perform

public abstract void perform(IProgressMonitor monitor)
Performs the drop action.

Parameters:
monitor - a progress monitor for showing the progress of the current event.

getData

public java.lang.Object getData()
Returns the dropped data. If the enablesFor is a anything other than null or 1 then an array of objects (all the same type) will be the data, otherwise the data will not be in an array.

Returns:
the dropped data.

getDestination

public java.lang.Object getDestination()
Returns the object that the data was dropped on.

Returns:
the object that the data was dropped on.

init

public void init(IConfigurationElement element2,
                 DropTargetEvent event2,
                 ViewerDropLocation location2,
                 java.lang.Object destination2,
                 java.lang.Object data2)
Called by framework to initialize the action.

Parameters:
element2 - the extension configuration element
event2 - the drop event.
location - wrt the destination.
destination2 - the object that the data was dropped on.
data2 - the data that was dropped.

getEvent

public DropTargetEvent getEvent()
The drop event.

Returns:
Returns the drop event.

getViewerLocation

public ViewerDropLocation getViewerLocation()
This does not always make sense for the drop event. But in the case that the component is a jface viewer then this method will indicate the location where the drop is taking place (before, on or after the destination object).

Returns:
If the component is not a viewer this will always return ViewerDropAdapter#LOCATION_ON otherwise it will be one of the LOCATION_* values.
See Also:
ViewerDropAdapter#getCurrentLocation()