Package org.eclipse.ui.navigator
Class CommonDragAdapterAssistant
- java.lang.Object
-
- org.eclipse.ui.navigator.CommonDragAdapterAssistant
-
- Direct Known Subclasses:
ResourceDragAdapterAssistant
public abstract class CommonDragAdapterAssistant extends Object
Assist theCommonDragAdapter
by providing new TransferTypes and the logic to handle setting up the transfer data. Clients must extend this class as part of the org.eclipse.ui.navigator.viewer/dragAssistant extension. By default, the Common Navigator supportsLocalSelectionTransfer
andPluginTransfer
.Clients may extend this class.
-
-
Constructor Summary
Constructors Constructor Description CommonDragAdapterAssistant()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dragFinished(DragSourceEvent anEvent, IStructuredSelection aSelection)
Allows the drag assistant to do any necessary cleanup after the drop operation is done.void
dragStart(DragSourceEvent anEvent, IStructuredSelection aSelection)
Allows the drag assistant indicate it wants to participate in the drag operation.INavigatorContentService
getContentService()
Shell
getShell()
abstract Transfer[]
getSupportedTransferTypes()
Extra TransferTypes allow the Navigator to generate different kinds of payloads for DND clients.void
setContentService(INavigatorContentService aContentService)
Accept and remember the content service this assistant is associated with.abstract boolean
setDragData(DragSourceEvent anEvent, IStructuredSelection aSelection)
Set the value of theEvent.data
field using the given selection.
-
-
-
Method Detail
-
getSupportedTransferTypes
public abstract Transfer[] getSupportedTransferTypes()
Extra TransferTypes allow the Navigator to generate different kinds of payloads for DND clients. By default, theCommonDragAdapter
supportsLocalSelectionTransfer
andPluginTransfer
.CommonDragAdapterAssistants can extend the available TransferTypes that a Common Navigator Viewer can generate. Clients should return the set of Transfer Types they support. When a drop event occurs, the available drag assistants will be searched for a enabled assistants for the
DragSourceEvent
. Only if the drop event occurs willsetDragData(DragSourceEvent, IStructuredSelection)
be called. If the drop event is cancelled,setDragData(DragSourceEvent, IStructuredSelection)
will not be called.- Returns:
- The added transfer types. (e.g. FileTransfer.getInstance()).
-
setDragData
public abstract boolean setDragData(DragSourceEvent anEvent, IStructuredSelection aSelection)
Set the value of theEvent.data
field using the given selection. Clients will only have an opportunity to set the drag data if they have returned a matching Transfer Type fromgetSupportedTransferTypes()
for theDragSourceEvent.dataType
.Clients will only have an opportunity to set the data when the drop event occurs. If the drop operation is cancelled, then this method will not be called.
- Parameters:
anEvent
- The event object should have itsEvent.data
field set to a value that matches a supportedTransferData
type.aSelection
- The current selection from the viewer.- Returns:
- True if the data could be set; false otherwise.
-
dragStart
public void dragStart(DragSourceEvent anEvent, IStructuredSelection aSelection)
Allows the drag assistant indicate it wants to participate in the drag operation. This is called atDragSourceListener.dragStart(DragSourceEvent)
time.- Parameters:
anEvent
- The event object should return doit = true if it wants to participate in the drag and set doit = false if it does not want to further participate.aSelection
- The current selection from the viewer.- Since:
- 3.4
-
dragFinished
public void dragFinished(DragSourceEvent anEvent, IStructuredSelection aSelection)
Allows the drag assistant to do any necessary cleanup after the drop operation is done. This is called atDragSourceListener.dragFinished(DragSourceEvent)
time. This is called on the same assistant that was called for the set data.- Parameters:
anEvent
- The event object should have itsEvent.data
field set to a value that matches a supportedTransferData
type.aSelection
- The current selection from the viewer.- Since:
- 3.4
-
setContentService
public final void setContentService(INavigatorContentService aContentService)
Accept and remember the content service this assistant is associated with.- Parameters:
aContentService
- associated content service
-
getContentService
public INavigatorContentService getContentService()
- Returns:
- The associated content service.
-
getShell
public final Shell getShell()
- Returns:
- The shell for the viewer this assistant is associated with or the shell of the active workbench window.
-
-