Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.navigator
Class CommonDropAdapter

java.lang.Object
  extended by 

org.eclipse.swt.dnd.DropTargetAdapter
      extended by 

org.eclipse.jface.viewers.ViewerDropAdapter
          extended by 

org.eclipse.ui.part.PluginDropAdapter
              extended by 
org.eclipse.ui.navigator.CommonDropAdapter
All Implemented Interfaces:
EventListener, DropTargetListener, 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.
  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 ()
           
 void overrideOperation (int operation)
          Overrides the current operation for a drop that happens immediately after the current validateDrop.
 boolean performDrop ( Object data)
          Performs any work associated with the drop.
 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
drop, getPluginAdapter
 
Methods inherited from class org.eclipse.jface.viewers. ViewerDropAdapter
clearState, determineLocation, determineTarget, dragOperationChanged, dragOver, dropAccept, getCurrentEvent, getFeedbackEnabled, getSelectedObject, getViewer, handleException, setExpandEnabled, setFeedbackEnabled, setScrollEnabled, 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
Parameters:
event - the information associated with the drag enter event
See Also:
DropTargetEvent

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
Parameters:
event - the information associated with the drag leave event
See Also:
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
Parameters:
data - the drop data
Returns:
true if the drop was successful, and false otherwise
See Also:
ViewerDropAdapter.performDrop(java.lang.Object)

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
Parameters:
aDropTarget - the object that the mouse is currently hovering over, or null if the mouse is hovering over empty space
theDropOperation - the current drag operation (copy, move, etc.)
theTransferData - the current transfer type
Returns:
true if the drop is valid, and false otherwise

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

overrideOperation

public void overrideOperation(int operation)
Description copied from class: ViewerDropAdapter
Overrides the current operation for a drop that happens immediately after the current validateDrop. This maybe called only from within a ViewerDropAdapter.validateDrop(Object, int, TransferData) method

Overrides:
overrideOperation in class ViewerDropAdapter
Parameters:
operation - the operation to be used for the drop.
Since:
3.4
See Also:
ViewerDropAdapter.overrideOperation(int)

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.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire