|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.swt.dnd.DropTargetAdapter
org.eclipse.jface.viewers.ViewerDropAdapter
This adapter class provides generic drag-and-drop support for a viewer.
Subclasses must implement the following methods:
validateDrop - identifies valid drop targets in viewerperformDrop - carries out a drop into a viewersetFeedbackEnabled method can be called to turn on and off
visual insertion feedback (on by default).
| Field Summary | |
|---|---|
static int |
LOCATION_AFTER
Constant describing the position of the cursor relative to the target object. |
static int |
LOCATION_BEFORE
Constant describing the position of the cursor relative to the target object. |
static int |
LOCATION_NONE
Constant describing the position of the cursor relative to the target object. |
static int |
LOCATION_ON
Constant describing the position of the cursor relative to the target object. |
| Constructor Summary | |
|---|---|
protected |
ViewerDropAdapter(Viewer viewer)
Creates a new drop adapter for the given viewer. |
| Method Summary | |
|---|---|
protected int |
determineLocation(DropTargetEvent event)
Returns the position of the given event's coordinates relative to its target. |
protected Object |
determineTarget(DropTargetEvent event)
Returns the target item of the given drop event. |
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 |
dragOperationChanged(DropTargetEvent event)
This implementation of dragOperationChanged permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType.
|
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.
|
void |
drop(DropTargetEvent event)
This implementation of drop does nothing.
|
void |
dropAccept(DropTargetEvent event)
This implementation of dropAccept permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType.
|
protected Rectangle |
getBounds(Item item)
Returns the bounds of the given SWT tree or table item. |
protected int |
getCurrentLocation()
Returns a constant describing the position of the mouse relative to the target (before, on, or after the target. |
protected int |
getCurrentOperation()
Returns the current operation. |
protected Object |
getCurrentTarget()
Returns the target object currently under the mouse. |
boolean |
getFeedbackEnabled()
Returns whether visible insertion feedback should be presented to the user. |
protected Object |
getSelectedObject()
Returns the object currently selected by the viewer. |
protected Viewer |
getViewer()
|
protected void |
handleException(Throwable exception,
DropTargetEvent event)
Deprecated. this method should not be used. Exception handling has been removed from DropTargetAdapter methods overridden by this class. Handles any exception that occurs during callback, including rethrowing behavior. [Issue: Implementation prints stack trace and eats exception to avoid crashing VA/J. Consider conditionalizing the implementation to do one thing in VAJ and something more reasonable in other operating environments. ] |
abstract boolean |
performDrop(Object data)
Performs any work associated with the drop. |
void |
setFeedbackEnabled(boolean value)
Sets whether visible insertion feedback should be presented to the user. |
void |
setScrollExpandEnabled(boolean value)
Sets whether auto scrolling and expanding should be provided during dragging. |
void |
setSelectionFeedbackEnabled(boolean value)
Sets whether selection feedback should be provided during dragging. |
abstract boolean |
validateDrop(Object target,
int operation,
TransferData transferType)
Validates dropping on the given object. |
| 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 |
| Field Detail |
public static final int LOCATION_BEFORE
getCurrentLocation(),
Constant Field Valuespublic static final int LOCATION_AFTER
getCurrentLocation(),
Constant Field Valuespublic static final int LOCATION_ON
getCurrentLocation(),
Constant Field Valuespublic static final int LOCATION_NONE
getCurrentLocation(),
Constant Field Values| Constructor Detail |
protected ViewerDropAdapter(Viewer viewer)
viewer - the viewer| Method Detail |
protected int determineLocation(DropTargetEvent event)
event - the event
LOCATION_* constants defined in this classprotected Object determineTarget(DropTargetEvent event)
event - the event
null.public void dragEnter(DropTargetEvent event)
DropTargetAdapterdragEnter 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.
dragEnter in interface DropTargetListenerdragEnter in class DropTargetAdapterpublic void dragOperationChanged(DropTargetEvent event)
DropTargetAdapterdragOperationChanged permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType.
For additional information see DropTargetListener.dragOperationChanged.
dragOperationChanged in interface DropTargetListenerdragOperationChanged in class DropTargetAdapterpublic void dragOver(DropTargetEvent event)
DropTargetAdapterdragOver 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.
dragOver in interface DropTargetListenerdragOver in class DropTargetAdapterpublic void drop(DropTargetEvent event)
DropTargetAdapterdrop does nothing.
For additional information see DropTargetListener.drop.
drop in interface DropTargetListenerdrop in class DropTargetAdapterpublic void dropAccept(DropTargetEvent event)
DropTargetAdapterdropAccept permits the default
operation defined in event.detailto be performed on the current data type
defined in event.currentDataType.
For additional information see DropTargetListener.dropAccept.
dropAccept in interface DropTargetListenerdropAccept in class DropTargetAdapterprotected Rectangle getBounds(Item item)
item - the SWT Item
null if it is not a known type of itemprotected int getCurrentLocation()
LOCATION_* constants defined in this typeprotected int getCurrentOperation()
DROP_* constant from class DNDDND.DROP_COPY,
DND.DROP_MOVE,
DND.DROP_LINK,
DND.DROP_NONEprotected Object getCurrentTarget()
public boolean getFeedbackEnabled()
Typical insertion feedback is the horizontal insertion bars that appear between adjacent items while dragging.
true if visual feedback is desired, and false if notprotected Object getSelectedObject()
null if either no object or
multiple objects are selectedprotected Viewer getViewer()
protected void handleException(Throwable exception,
DropTargetEvent event)
[Issue: Implementation prints stack trace and eats exception to avoid crashing VA/J. Consider conditionalizing the implementation to do one thing in VAJ and something more reasonable in other operating environments. ]
exception - the exceptionevent - the eventpublic abstract boolean performDrop(Object data)
Subclasses must implement this method to provide drop behavior.
data - the drop data
true if the drop was successful, and
false otherwisepublic void setFeedbackEnabled(boolean value)
Typical insertion feedback is the horizontal insertion bars that appear between adjacent items while dragging.
value - true if visual feedback is desired, and
false if notpublic void setSelectionFeedbackEnabled(boolean value)
value - true if selection feedback is desired, and
false if notpublic void setScrollExpandEnabled(boolean value)
value - true if scrolling and expanding is desired, and
false if not
public abstract boolean validateDrop(Object target,
int operation,
TransferData transferType)
Subclasses must implement this method to define which drops make sense.
target - the object that the mouse is currently hovering over, or
null if the mouse is hovering over empty spaceoperation - the current drag operation (copy, move, etc.)transferType - the current transfer type
true if the drop is valid, and false
otherwise
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.