Eclipse Platform
Release 3.2

org.eclipse.ui.navigator
Class CommonDropAdapter

java.lang.Object
  extended byorg.eclipse.swt.dnd.DropTargetAdapter
      extended byorg.eclipse.jface.viewers.ViewerDropAdapter
          extended byorg.eclipse.ui.part.PluginDropAdapter
              extended byorg.eclipse.ui.navigator.CommonDropAdapter
All Implemented Interfaces:
DropTargetListener, EventListener, org.eclipse.swt.internal.SWTEventListener

public final class CommonDropAdapter
extends PluginDropAdapter

Provides an implementation of 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.

Since:
3.2
See Also:
INavigatorDnDService, CommonDragAdapter, CommonDragAdapterAssistant, CommonDropAdapterAssistant, CommonViewer

Field Summary
 
Fields inherited from class org.eclipse.ui.part.PluginDropAdapter
ATT_CLASS
 
Fields inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
LOCATION_AFTER, LOCATION_BEFORE, LOCATION_NONE, LOCATION_ON
 
Constructor Summary
CommonDropAdapter(INavigatorContentService aContentService, StructuredViewer aStructuredViewer)
          Create a DropAdapter that handles a drop based on the given content service and selection provider.
 
Method Summary
 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.
 
Methods inherited from class org.eclipse.ui.part.PluginDropAdapter
getPluginAdapter, performDrop
 
Methods inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
determineLocation, determineTarget, dragOperationChanged, dragOver, dropAccept, getFeedbackEnabled, getSelectedObject, getViewer, handleException, setFeedbackEnabled, setScrollExpandEnabled, setSelectionFeedbackEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonDropAdapter

public CommonDropAdapter(INavigatorContentService aContentService,
                         StructuredViewer aStructuredViewer)
Create a DropAdapter that handles a drop based on the given content service and selection provider.

Parameters:
aContentService - The content service this Drop Adapter is associated with
aStructuredViewer - The viewer this DropAdapter is associated with.
Method Detail

getSupportedDropTransfers

public Transfer[] getSupportedDropTransfers()
Returns:
An array of Transfers allowed by the CommonDropAdapter. Includes LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance(), PluginTransfer.getInstance().
See Also:
LocalSelectionTransfer, FileTransfer, PluginTransfer

dragEnter

public void dragEnter(DropTargetEvent event)
Description copied from class: DropTargetAdapter
This implementation of dragEnter 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.

Specified by:
dragEnter in interface DropTargetListener
Overrides:
dragEnter in class ViewerDropAdapter

dragLeave

public void dragLeave(DropTargetEvent event)
Description copied from class: DropTargetAdapter
This implementation of dragLeave does nothing. For additional information see DropTargetListener.dragOperationChanged.

Specified by:
dragLeave in interface DropTargetListener
Overrides:
dragLeave in class DropTargetAdapter

drop

public void drop(DropTargetEvent event)
Description copied from class: DropTargetAdapter
This implementation of drop does nothing. For additional information see DropTargetListener.drop.

Specified by:
drop in interface DropTargetListener
Overrides:
drop in class PluginDropAdapter

validateDrop

public boolean validateDrop(Object aDropTarget,
                            int theDropOperation,
                            TransferData theTransferData)
Description copied from class: PluginDropAdapter
The PluginDropAdapter implementation of this ViewerDropAdapter method is used to notify the action that some aspect of the drop operation has changed. Subclasses may override.

Overrides:
validateDrop in class PluginDropAdapter

getBounds

public Rectangle getBounds(Item item)
Description copied from class: ViewerDropAdapter
Returns the bounds of the given SWT tree or table item.

Overrides:
getBounds in class ViewerDropAdapter
Parameters:
item - the SWT Item
Returns:
the bounds, or null if it is not a known type of item

getCurrentLocation

public int getCurrentLocation()
Description copied from class: ViewerDropAdapter
Returns a constant describing the position of the mouse relative to the target (before, on, or after the target.

Overrides:
getCurrentLocation in class ViewerDropAdapter
Returns:
one of the LOCATION_* constants defined in this type

getCurrentOperation

public int getCurrentOperation()
Description copied from class: ViewerDropAdapter
Returns the current operation.

Overrides:
getCurrentOperation in class ViewerDropAdapter
Returns:
a DROP_* constant from class DND
See Also:
DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK, DND.DROP_NONE

getCurrentTarget

public Object getCurrentTarget()
Description copied from class: ViewerDropAdapter
Returns the target object currently under the mouse.

Overrides:
getCurrentTarget in class ViewerDropAdapter
Returns:
the current target object

getCurrentTransfer

public TransferData getCurrentTransfer()
Description copied from class: PluginDropAdapter
Returns the current transfer.

Overrides:
getCurrentTransfer in class PluginDropAdapter

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.