|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.navigator.CommonDropAdapterAssistant
Used by the org.eclipse.ui.navigator.navigatorContent/navigatorContent/commonDropAdapter extension point to carry out pluggable drop operations.
Each CommonDropAdapterAssistant
is contained by single content
extension. The opportunity for each assistant to handle the drop operation is
determined by the possibleChildren expression of the
org.eclipse.ui.navigator.navigatorContent/navigatorContent extension;
whenever every element in the drag set matches the possibleChildren
expression of an extension, it is eligible to handle the drop operation. This
initial set is further culled using the possibleDropTargets
expression of the commonDropAdapter using the current drop target.
If drag operations originate outside of Eclipse, then the set of eligible
drop adapters is determined based on the drop target (using the
possibleDropTargets expression). Each assistant can then indicate
whether the incoming type is supported
.
Whenever a match is found, the assistant will be given an opportunity to
first validateDrop(Object, int, TransferData)
, and then if the
assistant returns true, the assist must
handleDrop(CommonDropAdapter, DropTargetEvent, Object)
. If
multiple assistants match the drop target, then the potential assistants are
ordered based on priority and their override relationships and given an
opportunity to validate the drop operation in turn. The first one to validate
will have the opportunty to carry out the drop.
Clients may handle DND operations that begin and end in the current viewer by overriding the following methods:
validateDrop(Object, int, TransferData)
: Indicate whether this
assistant can handle a drop onto the current viewer.handleDrop(CommonDropAdapter, DropTargetEvent, Object)
: Handle
the drop operation onto the current viewer.If a user originates a drag operation to another viewer that cannot handle one of the available drag transfer types, drop assistants may handle the drop operation for the target viewer. Clients must override :
validatePluginTransferDrop(IStructuredSelection, Object)
:
Indicate whether this assistant can handle the drop onto another viewer.
handlePluginTransferDrop(IStructuredSelection, Object)
: Handle
the drop operation onto the other viewer.Clients may implement this interface.
INavigatorDnDService
,
INavigatorDnDService.findCommonDropAdapterAssistants(Object,
TransferData)
Constructor Summary | |
---|---|
CommonDropAdapterAssistant()
|
Method Summary | |
---|---|
protected void |
doInit()
Override to perform any one-time initialization. |
protected INavigatorContentService |
getContentService()
|
protected Shell |
getShell()
|
abstract IStatus |
handleDrop(CommonDropAdapter aDropAdapter,
DropTargetEvent aDropTargetEvent,
Object aTarget)
Carry out the DND operation. |
IStatus |
handlePluginTransferDrop(IStructuredSelection aDragSelection,
Object aDropTarget)
Handle the drop operation for the target viewer. |
void |
init(INavigatorContentService aContentService)
Perform any necessary initialization using the INavigatorContentService . |
boolean |
isSupportedType(TransferData aTransferType)
Clients may extend the supported transfer types beyond the default LocalSelectionTransfer.getTransfer() and
PluginTransfer.getInstance() transfer types. |
abstract IStatus |
validateDrop(Object target,
int operation,
TransferData transferType)
Validates dropping on the given object. |
IStatus |
validatePluginTransferDrop(IStructuredSelection aDragSelection,
Object aDropTarget)
Return true if the client can handle the drop onto the target viewer of the drop operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CommonDropAdapterAssistant()
Method Detail |
public final void init(INavigatorContentService aContentService)
INavigatorContentService
.
aContentService
- The instance of INavigatorContentService
that the
current CommonDropAdapterAssistant will be associated withprotected void doInit()
public abstract IStatus validateDrop(Object target, int operation, TransferData transferType)
Subclasses must implement this method to define which drops make sense.
If clients return true, then they will be allowed to handle the drop in
handleDrop(CommonDropAdapter, DropTargetEvent, Object)
.
target
- the object that the mouse is currently hovering over, or
null
if the mouse is hovering over empty spaceoperation
- the current drag operation (copy, move, etc.)transferType
- the current transfer type
public abstract IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget)
aDropAdapter
- The Drop Adapter contains information that has already been
parsed from the drop event.aDropTargetEvent
- The drop target event.aTarget
- The object being dragged onto
public boolean isSupportedType(TransferData aTransferType)
LocalSelectionTransfer.getTransfer()
and
PluginTransfer.getInstance()
transfer types. When a transfer type
other than one of these is encountered, the DND Service will query the
visible and active descriptors that are enabled
for the drop target of the current operation.
aTransferType
- The transfer data from the drop operation
public IStatus validatePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget)
The default behavior of this method is to return Status.CANCEL_STATUS.
aDragSelection
- The selection dragged from the viewer.aDropTarget
- The target of the drop operation.
public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget)
The default behavior of this method is to return Status.CANCEL_STATUS.
aDragSelection
- The selection dragged from the viewer.aDropTarget
- The target of the drop operation.
protected INavigatorContentService getContentService()
protected final Shell getShell()
INavigatorContentService
.
|
Eclipse Platform Release 3.2 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.