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,
CommonViewerATT_CLASSLOCATION_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 |
|---|---|
protected int |
determineLocation(DropTargetEvent event)
Returns the position of the given event's coordinates relative to its target.
|
void |
dragEnter(DropTargetEvent event)
This implementation of
dragEnter permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType. |
void |
dragLeave(DropTargetEvent event)
This implementation of
dragLeave does nothing. |
void |
drop(DropTargetEvent event)
This implementation of
drop 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() |
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. |
getPluginAdapter, performDropdetermineTarget, dragOperationChanged, dragOver, dropAccept, getFeedbackEnabled, getSelectedObject, getViewer, handleException, setFeedbackEnabled, setScrollExpandEnabled, setSelectionFeedbackEnabledpublic 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,
PluginTransferpublic void dragEnter(DropTargetEvent event)
DropTargetAdapterdragEnter permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType.
For additional information see DropTargetListener.dragEnter.dragEnter in interface DropTargetListenerdragEnter in class ViewerDropAdapterevent - the information associated with the drag enter eventDropTargetEventpublic void dragLeave(DropTargetEvent event)
DropTargetAdapterdragLeave does nothing.
For additional information see DropTargetListener.dragOperationChanged.dragLeave in interface DropTargetListenerdragLeave in class DropTargetAdapterevent - the information associated with the drag leave eventDropTargetEventpublic void drop(DropTargetEvent event)
DropTargetAdapterdrop does nothing.
For additional information see DropTargetListener.drop.drop in interface DropTargetListenerdrop in class PluginDropAdapterevent - the information associated with the drop eventDropTargetEventpublic boolean validateDrop(Object aDropTarget, int theDropOperation, TransferData theTransferData)
PluginDropAdapterPluginDropAdapter 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 PluginDropAdapteraDropTarget - 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)
ViewerDropAdaptergetBounds in class ViewerDropAdapteritem - the SWT Itemnull if it is not a known type of itempublic int getCurrentLocation()
ViewerDropAdaptergetCurrentLocation in class ViewerDropAdapterLOCATION_* constants defined in this typepublic int getCurrentOperation()
ViewerDropAdaptergetCurrentOperation in class ViewerDropAdapterDROP_* constant from class DNDDND.DROP_COPY,
DND.DROP_MOVE,
DND.DROP_LINK,
DND.DROP_NONEpublic Object getCurrentTarget()
ViewerDropAdaptergetCurrentTarget in class ViewerDropAdapterpublic TransferData getCurrentTransfer()
PluginDropAdaptergetCurrentTransfer in class PluginDropAdapterprotected int determineLocation(DropTargetEvent event)
determineLocation in class ViewerDropAdapterevent - the eventLOCATION_* constants defined in this classGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.