Class ResourceDropAdapterAssistant

  • public class ResourceDropAdapterAssistant
    extends CommonDropAdapterAssistant
    Clients may reference this class in the dropAssistant element of a org.eclipse.ui.navigator.navigatorContent extension point.

    Clients may not extend or instantiate this class for any purpose. Clients may have no direct dependencies on the contract of this class.

    • Constructor Detail

      • ResourceDropAdapterAssistant

        public ResourceDropAdapterAssistant()
    • Method Detail

      • validateDrop

        public IStatus validateDrop​(Object target,
                                    int aDropOperation,
                                    TransferData transferType)
        Description copied from class: CommonDropAdapterAssistant
        Validates dropping on the given object. This method is called whenever some aspect of the drop operation changes.

        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 CommonDropAdapterAssistant.handleDrop(CommonDropAdapter, DropTargetEvent, Object).

        Specified by:
        validateDrop in class CommonDropAdapterAssistant
        target - the object that the mouse is currently hovering over, or null if the mouse is hovering over empty space
        aDropOperation - the current drag operation (copy, move, etc.)
        transferType - the current transfer type
        A status indicating whether the drop is valid.
      • handleDrop

        public IStatus handleDrop​(CommonDropAdapter aDropAdapter,
                                  DropTargetEvent aDropTargetEvent,
                                  Object aTarget)
        Description copied from class: CommonDropAdapterAssistant
        Carry out the DND operation.

        Note: Contrary to the SWT DropTargetListener specification, you must make sure that the aDropTargetEvent.detail is not set to DND.DROP_MOVE unless actual work is required in the DragSourceListener.dragFinished(org.eclipse.swt.dnd.DragSourceEvent) to complete the operation (for example removing the moved file). In particular for the LocalSelectionTransfer case, DND.DROP_MOVE cannot be used as it will cause incorrect behavior in some existing drag handlers. In case of move operations where no action is required on the source side (e.g. LocalSelectionTransfer) you must set aDropTargetEvent.detail to DND.DROP_NONE to signal this to the drag source. Even though the SWT specification says this is canceling the drop, it is not really doing so, it is only preventing the DND.DROP_MOVE from being passed through to the dragFinished() method.

        Specified by:
        handleDrop in class CommonDropAdapterAssistant
        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
        A status indicating whether the drop completed OK.
      • validatePluginTransferDrop

        public IStatus validatePluginTransferDrop​(IStructuredSelection aDragSelection,
                                                  Object aDropTarget)
        Description copied from class: CommonDropAdapterAssistant
        Return true if the client can handle the drop onto the target viewer of the drop operation.

        The default behavior of this method is to return Status.CANCEL_STATUS.

        validatePluginTransferDrop in class CommonDropAdapterAssistant
        aDragSelection - The selection dragged from the viewer.
        aDropTarget - The target of the drop operation.
        OK if the plugin transfer can be handled by this assistant.