Package org.eclipse.ui.navigator
Class CommonDropAdapter
java.lang.Object
org.eclipse.swt.dnd.DropTargetAdapter
org.eclipse.jface.viewers.ViewerDropAdapter
org.eclipse.ui.part.PluginDropAdapter
org.eclipse.ui.navigator.CommonDropAdapter
- All Implemented Interfaces:
EventListener
,DropTargetListener
,SWTEventListener
Provides an implementation of
PluginDropAdapter
which uses the
extensions provided by the associated INavigatorContentService
.
Clients should not need to create an instance of this class unless they are
creating their own custom viewer. Otherwise, CommonViewer
configures
its drop adapter automatically.
-
Field Summary
Fields inherited from class org.eclipse.ui.part.PluginDropAdapter
ATT_CLASS
Fields inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
LOCATION_AFTER, LOCATION_BEFORE, LOCATION_NONE, LOCATION_ON
-
Constructor Summary
ConstructorDescriptionCommonDropAdapter
(INavigatorContentService aContentService, StructuredViewer aStructuredViewer) Create a DropAdapter that handles a drop based on the given content service and selection provider. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dragEnter
(DropTargetEvent event) This implementation ofdragEnter
permits the default operation defined inevent.detail
to be performed on the current data type defined inevent.currentDataType
.void
dragLeave
(DropTargetEvent event) This implementation ofdragLeave
does nothing.Returns the bounds of the given SWT tree or table item.int
Returns a constant describing the position of the mouse relative to the target (before, on, or after the target.int
Returns the current operation.Returns the target object currently under the mouse.Returns the current transfer.Transfer[]
void
overrideOperation
(int operation) Overrides the current operation for a drop that happens immediately after the current validateDrop.boolean
performDrop
(Object data) Performs any work associated with the drop.boolean
validateDrop
(Object aDropTarget, int theDropOperation, TransferData theTransferData) ThePluginDropAdapter
implementation of thisViewerDropAdapter
method is used to notify the action that some aspect of the drop operation has changed.Methods inherited from class org.eclipse.ui.part.PluginDropAdapter
drop, getPluginAdapter
Methods inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
clearState, determineLocation, determineTarget, dragOperationChanged, dragOver, dropAccept, getCurrentEvent, getFeedbackEnabled, getSelectedObject, getThreshold, getViewer, handleException, setExpandEnabled, setFeedbackEnabled, setScrollEnabled, setScrollExpandEnabled, setSelectionFeedbackEnabled
-
Constructor Details
-
Method Details
-
getSupportedDropTransfers
- Returns:
- An array of Transfers allowed by the CommonDropAdapter. Includes
LocalSelectionTransfer.getTransfer()
,FileTransfer.getInstance()
,PluginTransfer.getInstance()
. - See Also:
-
dragEnter
Description copied from class:DropTargetAdapter
This implementation ofdragEnter
permits the default operation defined inevent.detail
to be performed on the current data type defined inevent.currentDataType
. For additional information seeDropTargetListener.dragEnter
.- Specified by:
dragEnter
in interfaceDropTargetListener
- Overrides:
dragEnter
in classViewerDropAdapter
- Parameters:
event
- the information associated with the drag enter event- See Also:
-
dragLeave
Description copied from class:DropTargetAdapter
This implementation ofdragLeave
does nothing. For additional information seeDropTargetListener.dragOperationChanged
.- Specified by:
dragLeave
in interfaceDropTargetListener
- Overrides:
dragLeave
in classDropTargetAdapter
- Parameters:
event
- the information associated with the drag leave event- See Also:
-
performDrop
Description copied from class:ViewerDropAdapter
Performs any work associated with the drop.Subclasses must implement this method to provide drop behavior.
- Overrides:
performDrop
in classPluginDropAdapter
- Parameters:
data
- the drop data- Returns:
true
if the drop was successful, andfalse
otherwise- See Also:
-
validateDrop
Description copied from class:PluginDropAdapter
ThePluginDropAdapter
implementation of thisViewerDropAdapter
method is used to notify the action that some aspect of the drop operation has changed. Subclasses may override.- Overrides:
validateDrop
in classPluginDropAdapter
- Parameters:
aDropTarget
- the object that the mouse is currently hovering over, ornull
if the mouse is hovering over empty spacetheDropOperation
- the current drag operation (copy, move, etc.)theTransferData
- the current transfer type- Returns:
true
if the drop is valid, andfalse
otherwise
-
getBounds
Description copied from class:ViewerDropAdapter
Returns the bounds of the given SWT tree or table item.- Overrides:
getBounds
in classViewerDropAdapter
- Parameters:
item
- the SWT Item- Returns:
- the bounds, or
null
if it is not a known type of item
-
getCurrentLocation
public int getCurrentLocation()Description copied from class:ViewerDropAdapter
Returns a constant describing the position of the mouse relative to the target (before, on, or after the target.- Overrides:
getCurrentLocation
in classViewerDropAdapter
- Returns:
- one of the
LOCATION_*
constants defined in this type
-
getCurrentOperation
public int getCurrentOperation()Description copied from class:ViewerDropAdapter
Returns the current operation.- Overrides:
getCurrentOperation
in classViewerDropAdapter
- Returns:
- a
DROP_*
constant from classDND
- See Also:
-
overrideOperation
public void overrideOperation(int operation) Description copied from class:ViewerDropAdapter
Overrides the current operation for a drop that happens immediately after the current validateDrop. This maybe called only from within aViewerDropAdapter.validateDrop(Object, int, TransferData)
method- Overrides:
overrideOperation
in classViewerDropAdapter
- Parameters:
operation
- the operation to be used for the drop.- Since:
- 3.4
- See Also:
-
getCurrentTarget
Description copied from class:ViewerDropAdapter
Returns the target object currently under the mouse.- Overrides:
getCurrentTarget
in classViewerDropAdapter
- Returns:
- the current target object
-
getCurrentTransfer
Description copied from class:PluginDropAdapter
Returns the current transfer.- Overrides:
getCurrentTransfer
in classPluginDropAdapter
-