public final class CommonDropAdapter extends PluginDropAdapter
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.
INavigatorDnDService
,
CommonDragAdapter
,
CommonDragAdapterAssistant
,
CommonDropAdapterAssistant
,
CommonViewer
ATT_CLASS
LOCATION_AFTER, LOCATION_BEFORE, LOCATION_NONE, LOCATION_ON
Constructor and Description |
---|
CommonDropAdapter(INavigatorContentService aContentService,
StructuredViewer aStructuredViewer)
Create a DropAdapter that handles a drop based on the given content
service and selection provider.
|
Modifier and Type | Method and Description |
---|---|
void |
dragEnter(DropTargetEvent event)
This implementation of
dragEnter permits the default
operation defined in event.detail to be performed on the current data type
defined in event.currentDataType . |
void |
dragLeave(DropTargetEvent event)
This implementation of
dragLeave does nothing. |
Rectangle |
getBounds(Item item)
Returns the bounds of the given SWT tree or table item.
|
int |
getCurrentLocation()
Returns a constant describing the position of the mouse relative to the
target (before, on, or after the target.
|
int |
getCurrentOperation()
Returns the current operation.
|
Object |
getCurrentTarget()
Returns the target object currently under the mouse.
|
TransferData |
getCurrentTransfer()
Returns the current transfer.
|
Transfer[] |
getSupportedDropTransfers() |
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)
The
PluginDropAdapter implementation of this
ViewerDropAdapter method is used to notify the action that some
aspect of the drop operation has changed. |
drop, getPluginAdapter
clearState, determineLocation, determineTarget, dragOperationChanged, dragOver, dropAccept, getCurrentEvent, getFeedbackEnabled, getSelectedObject, getViewer, handleException, setExpandEnabled, setFeedbackEnabled, setScrollEnabled, setScrollExpandEnabled, setSelectionFeedbackEnabled
public CommonDropAdapter(INavigatorContentService aContentService, StructuredViewer aStructuredViewer)
aContentService
- The content service this Drop Adapter is associated withaStructuredViewer
- The viewer this DropAdapter is associated with.public Transfer[] getSupportedDropTransfers()
LocalSelectionTransfer.getTransfer()
,
FileTransfer.getInstance()
,
PluginTransfer.getInstance()
.LocalSelectionTransfer
,
FileTransfer
,
PluginTransfer
public void dragEnter(DropTargetEvent event)
DropTargetAdapter
dragEnter
permits the default
operation defined in event.detail
to be performed on the current data type
defined in event.currentDataType
.
For additional information see DropTargetListener.dragEnter
.dragEnter
in interface DropTargetListener
dragEnter
in class ViewerDropAdapter
event
- the information associated with the drag enter eventDropTargetEvent
public void dragLeave(DropTargetEvent event)
DropTargetAdapter
dragLeave
does nothing.
For additional information see DropTargetListener.dragOperationChanged
.dragLeave
in interface DropTargetListener
dragLeave
in class DropTargetAdapter
event
- the information associated with the drag leave eventDropTargetEvent
public boolean performDrop(Object data)
ViewerDropAdapter
Subclasses must implement this method to provide drop behavior.
performDrop
in class PluginDropAdapter
data
- the drop datatrue
if the drop was successful, and
false
otherwiseViewerDropAdapter.performDrop(java.lang.Object)
public boolean validateDrop(Object aDropTarget, int theDropOperation, TransferData theTransferData)
PluginDropAdapter
PluginDropAdapter
implementation of this
ViewerDropAdapter
method is used to notify the action that some
aspect of the drop operation has changed. Subclasses may override.validateDrop
in class PluginDropAdapter
aDropTarget
- the object that the mouse is currently hovering over, or
null
if the mouse is hovering over empty spacetheDropOperation
- the current drag operation (copy, move, etc.)theTransferData
- the current transfer typetrue
if the drop is valid, and false
otherwisepublic Rectangle getBounds(Item item)
ViewerDropAdapter
getBounds
in class ViewerDropAdapter
item
- the SWT Itemnull
if it is not a known type of itempublic int getCurrentLocation()
ViewerDropAdapter
getCurrentLocation
in class ViewerDropAdapter
LOCATION_*
constants defined in this typepublic int getCurrentOperation()
ViewerDropAdapter
getCurrentOperation
in class ViewerDropAdapter
DROP_*
constant from class DND
DND.DROP_COPY
,
DND.DROP_MOVE
,
DND.DROP_LINK
,
DND.DROP_NONE
public void overrideOperation(int operation)
ViewerDropAdapter
ViewerDropAdapter.validateDrop(Object, int, TransferData)
methodoverrideOperation
in class ViewerDropAdapter
operation
- the operation to be used for the drop.ViewerDropAdapter.overrideOperation(int)
public Object getCurrentTarget()
ViewerDropAdapter
getCurrentTarget
in class ViewerDropAdapter
public TransferData getCurrentTransfer()
PluginDropAdapter
getCurrentTransfer
in class PluginDropAdapter
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.