| org.eclipse.jface.viewers.ViewerDropAdapter
ViewerDropAdapter | abstract public class ViewerDropAdapter extends DropTargetAdapter (Code) | | This adapter class provides generic drag-and-drop support for a viewer.
Subclasses must implement the following methods:
validateDrop - identifies valid drop targets in viewer
performDrop - carries out a drop into a viewer
The setFeedbackEnabled method can be called to turn on and off
visual insertion feedback (on by default).
|
Field Summary | |
final public static int | LOCATION_AFTER Constant describing the position of the cursor relative
to the target object. | final public static int | LOCATION_BEFORE Constant describing the position of the cursor relative
to the target object. | final public static int | LOCATION_NONE Constant describing the position of the cursor relative
to the target object. | final public static int | LOCATION_ON Constant describing the position of the cursor relative
to the target object. |
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. | public void | dragEnter(DropTargetEvent event) | public void | dragOperationChanged(DropTargetEvent event) | public void | dragOver(DropTargetEvent event) | public void | drop(DropTargetEvent event) | public void | dropAccept(DropTargetEvent event) | 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. | public 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) | abstract public boolean | performDrop(Object data) Performs any work associated with the drop. | public void | setExpandEnabled(boolean value) Sets whether auto expanding should be provided during dragging. | public void | setFeedbackEnabled(boolean value) Sets whether visible insertion feedback should be presented to the user. | public void | setScrollEnabled(boolean value) Sets whether auto scrolling should be provided during dragging. | public void | setScrollExpandEnabled(boolean value) Sets whether auto scrolling and expanding should be provided during dragging. | public void | setSelectionFeedbackEnabled(boolean value) Sets whether selection feedback should be provided during dragging. | abstract public boolean | validateDrop(Object target, int operation, TransferData transferType) Validates dropping on the given object. |
LOCATION_AFTER | final public static int LOCATION_AFTER(Code) | | Constant describing the position of the cursor relative
to the target object. This means the mouse is positioned
slightly after the target.
See Also: ViewerDropAdapter.getCurrentLocation() |
LOCATION_BEFORE | final public static int LOCATION_BEFORE(Code) | | Constant describing the position of the cursor relative
to the target object. This means the mouse is positioned
slightly before the target.
See Also: ViewerDropAdapter.getCurrentLocation() |
LOCATION_NONE | final public static int LOCATION_NONE(Code) | | Constant describing the position of the cursor relative
to the target object. This means the mouse is not positioned
over or near any valid target.
See Also: ViewerDropAdapter.getCurrentLocation() |
LOCATION_ON | final public static int LOCATION_ON(Code) | | Constant describing the position of the cursor relative
to the target object. This means the mouse is positioned
directly on the target.
See Also: ViewerDropAdapter.getCurrentLocation() |
ViewerDropAdapter | protected ViewerDropAdapter(Viewer viewer)(Code) | | Creates a new drop adapter for the given viewer.
Parameters: viewer - the viewer |
determineLocation | protected int determineLocation(DropTargetEvent event)(Code) | | Returns the position of the given event's coordinates relative to its target.
The position is determined to be before, after, or on the item, based on
some threshold value.
Parameters: event - the event one of the LOCATION_* constants defined in this class |
determineTarget | protected Object determineTarget(DropTargetEvent event)(Code) | | Returns the target item of the given drop event.
Parameters: event - the event The target of the drop, may be null . |
dragEnter | public void dragEnter(DropTargetEvent event)(Code) | | |
dragOperationChanged | public void dragOperationChanged(DropTargetEvent event)(Code) | | |
dragOver | public void dragOver(DropTargetEvent event)(Code) | | |
drop | public void drop(DropTargetEvent event)(Code) | | |
dropAccept | public void dropAccept(DropTargetEvent event)(Code) | | |
getBounds | protected Rectangle getBounds(Item item)(Code) | | Returns the bounds of the given SWT tree or table item.
Parameters: item - the SWT Item the bounds, or null if it is not a known type of item |
getCurrentLocation | protected int getCurrentLocation()(Code) | | Returns a constant describing the position of the mouse relative to the
target (before, on, or after the target.
one of the LOCATION_* constants defined in this type |
getCurrentOperation | protected int getCurrentOperation()(Code) | | Returns the current operation.
a DROP_* constant from class DND See Also: DND.DROP_COPY See Also: DND.DROP_MOVE See Also: DND.DROP_LINK See Also: DND.DROP_NONE |
getCurrentTarget | protected Object getCurrentTarget()(Code) | | Returns the target object currently under the mouse.
the current target object |
getFeedbackEnabled | public boolean getFeedbackEnabled()(Code) | | Returns whether visible insertion feedback should be presented to the user.
Typical insertion feedback is the horizontal insertion bars that appear
between adjacent items while dragging.
true if visual feedback is desired, and false if not |
getSelectedObject | protected Object getSelectedObject()(Code) | | Returns the object currently selected by the viewer.
the selected object, or null if either no object or multiple objects are selected |
getViewer | protected Viewer getViewer()(Code) | | the viewer to which this drop support has been added. |
handleException | protected void handleException(Throwable exception, DropTargetEvent event)(Code) | | Parameters: exception - the exception Parameters: event - the event |
performDrop | abstract public boolean performDrop(Object data)(Code) | | Performs any work associated with the drop.
Subclasses must implement this method to provide drop behavior.
Parameters: data - the drop data true if the drop was successful, and false otherwise |
setExpandEnabled | public void setExpandEnabled(boolean value)(Code) | | Sets whether auto expanding should be provided during dragging.
Parameters: value - true if expanding is desired, andfalse if not since: 3.4 |
setFeedbackEnabled | public void setFeedbackEnabled(boolean value)(Code) | | Sets whether visible insertion feedback should be presented to the user.
Typical insertion feedback is the horizontal insertion bars that appear
between adjacent items while dragging.
Parameters: value - true if visual feedback is desired, andfalse if not |
setScrollEnabled | public void setScrollEnabled(boolean value)(Code) | | Sets whether auto scrolling should be provided during dragging.
Parameters: value - true if scrolling is desired, andfalse if not since: 3.4 |
setScrollExpandEnabled | public void setScrollExpandEnabled(boolean value)(Code) | | Sets whether auto scrolling and expanding should be provided during dragging.
Parameters: value - true if scrolling and expanding is desired, andfalse if not since: 2.0 |
setSelectionFeedbackEnabled | public void setSelectionFeedbackEnabled(boolean value)(Code) | | Sets whether selection feedback should be provided during dragging.
Parameters: value - true if selection feedback is desired, andfalse if not since: 3.2 |
validateDrop | abstract public boolean validateDrop(Object target, int operation, TransferData transferType)(Code) | | 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.
Parameters: target - the object that the mouse is currently hovering over, ornull if the mouse is hovering over empty space Parameters: operation - the current drag operation (copy, move, etc.) Parameters: transferType - the current transfer type true if the drop is valid, and false otherwise |
|
|