Eclipse Platform
2.0

org.eclipse.ui.views.navigator
Class NavigatorDropAdapter

java.lang.Object
  |
  +--org.eclipse.swt.dnd.DropTargetAdapter
        |
        +--org.eclipse.jface.viewers.ViewerDropAdapter
              |
              +--org.eclipse.ui.part.PluginDropAdapter
                    |
                    +--org.eclipse.ui.views.navigator.NavigatorDropAdapter
All Implemented Interfaces:
DropTargetListener, EventListener, IOverwriteQuery, org.eclipse.swt.internal.SWTEventListener

public class NavigatorDropAdapter
extends PluginDropAdapter
implements IOverwriteQuery

Implements drop behaviour for drag and drop operations that land on the resource navigator.

Since:
2.0

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
 
Fields inherited from interface org.eclipse.ui.dialogs.IOverwriteQuery
ALL, CANCEL, NO, NO_ALL, YES
 
Constructor Summary
NavigatorDropAdapter(StructuredViewer viewer)
          Constructs a new drop adapter.
 
Method Summary
 void dragOver(DropTargetEvent event)
          This implementation of dragOver permits the default operation defined in event.detailto be performed on the current data type defined in event.currentDataType.
 boolean performDrop(Object data)
          Performs any work associated with the drop.
 String queryOverwrite(String pathString)
          Returns one of the return code constants declared on this interface, indicating whether the entity represented by the passed String should be overwritten.
 boolean validateDrop(Object target, int operation, TransferData transferType)
          This 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
drop, getCurrentTransfer, getPluginAdapter
 
Methods inherited from class org.eclipse.jface.viewers.ViewerDropAdapter
determineLocation, determineTarget, dragEnter, dragOperationChanged, dropAccept, getBounds, getCurrentLocation, getCurrentOperation, getCurrentTarget, getFeedbackEnabled, getSelectedObject, getViewer, handleException, setFeedbackEnabled, setScrollExpandEnabled
 
Methods inherited from class org.eclipse.swt.dnd.DropTargetAdapter
dragLeave
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NavigatorDropAdapter

public NavigatorDropAdapter(StructuredViewer viewer)
Constructs a new drop adapter.

Method Detail

dragOver

public void dragOver(DropTargetEvent event)
Description copied from class: DropTargetAdapter
This implementation of dragOver permits the default operation defined in event.detailto be performed on the current data type defined in event.currentDataType. For additional information see DropTargetListener.dragOver.

Specified by:
dragOver in interface DropTargetListener
Overrides:
dragOver in class ViewerDropAdapter
Parameters:
event - the information associated with the drag over event
See Also:
DropTargetListener.dragOver(org.eclipse.swt.dnd.DropTargetEvent)

performDrop

public boolean performDrop(Object data)
Description copied from class: ViewerDropAdapter
Performs any work associated with the drop.

Subclasses must implement this method to provide drop behavior.

Overrides:
performDrop in class PluginDropAdapter
See Also:
DropTargetListener#performDrop

queryOverwrite

public String queryOverwrite(String pathString)
Description copied from interface: IOverwriteQuery
Returns one of the return code constants declared on this interface, indicating whether the entity represented by the passed String should be overwritten.

This method may be called from a non-UI thread, in which case this method must run the query in a sync exec in the UI thread, if it needs to query the user.

Specified by:
queryOverwrite in interface IOverwriteQuery
Parameters:
pathString - the path representing the entity to be overwritten
Returns:
one of the return code constants declared on this interface
See Also:
IOverwriteQuery.queryOverwrite(java.lang.String)

validateDrop

public boolean validateDrop(Object target,
                            int operation,
                            TransferData transferType)
This method is used to notify the action that some aspect of the drop operation has changed.

Overrides:
validateDrop in class PluginDropAdapter
Parameters:
target - the object that the mouse is currently hovering over, or null if the mouse is hovering over empty space
operation - the current drag operation (copy, move, etc.)
transferType - the current transfer type
Returns:
true if the drop is valid, and false otherwise

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.