Package com.iizigo.navigator
Class DragAdapterAssistant
java.lang.Object
org.eclipse.ui.navigator.CommonDragAdapterAssistant
org.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant
com.iizigo.navigator.DragAdapterAssistant
public class DragAdapterAssistant extends org.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant
Assist the CommonDragAdapter 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 supports LocalSelectionTransfer and PluginTransfer.
- Author:
- Christopher Mindus
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionvoid
dragFinished
(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Allows the drag assistant to do any necessary cleanup after the drop operation is done.void
dragStart
(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Allows the drag assistant indicate it wants to participate in the drag operation.org.eclipse.swt.dnd.Transfer[]
Extra TransferTypes allow the Navigator to generate different kinds of payloads for DND clients.boolean
setDragData
(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Set the value of the org.eclipse.swt.widgets.Event.data field using the given selection.Methods inherited from class org.eclipse.ui.navigator.CommonDragAdapterAssistant
getContentService, getShell, setContentService
Constructor Details
DragAdapterAssistant
public DragAdapterAssistant()The Eclipse constructor.
Method Details
getSupportedTransferTypes
public org.eclipse.swt.dnd.Transfer[] getSupportedTransferTypes()Extra TransferTypes allow the Navigator to generate different kinds of payloads for DND clients. By default, the CommonDragAdapter supports LocalSelectionTransfer and PluginTransfer.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 will setDragData(DragSourceEvent, IStructuredSelection)} be called. If the drop event is cancelled, setDragData(DragSourceEvent, IStructuredSelection)} will not be called.
- Overrides:
getSupportedTransferTypes
in classorg.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant
- Returns:
- The added transfer types: PropertiesTransfer.
dragStart
public void dragStart(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Allows the drag assistant indicate it wants to participate in the drag operation. This is called at DragSourceListener.dragStart(DragSourceEvent) time.- Overrides:
dragStart
in classorg.eclipse.ui.navigator.CommonDragAdapterAssistant
- Parameters:
event
- 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.selection
- The current selection from the viewer.
setDragData
public boolean setDragData(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Set the value of the org.eclipse.swt.widgets.Event.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 from getSupportedTransferTypes() for the DragSourceEvent#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.
- Overrides:
setDragData
in classorg.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant
- Parameters:
event
- The event object should have its Event.data field set to a value that matches a supported TransferData type.selection
- The current selection from the viewer.- Returns:
- True if the data could be set; false otherwise.
dragFinished
public void dragFinished(org.eclipse.swt.dnd.DragSourceEvent event, org.eclipse.jface.viewers.IStructuredSelection selection) Allows the drag assistant to do any necessary cleanup after the drop operation is done. This is called at DragSourceListener.dragFinished(DragSourceEvent) time. This is called on the same assistant that was called for the set data.- Overrides:
dragFinished
in classorg.eclipse.ui.navigator.CommonDragAdapterAssistant
- Parameters:
event
- The event object should have its Event.data field set to a value that matches a supported TransferData type.selection
- The current selection from the viewer.