Package org.eclipse.swt.dnd
Class DND
java.lang.Object
org.eclipse.swt.dnd.DND
Class DND contains all the constants used in defining a
DragSource or a DropTarget.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The transfer mechanism for data that is being cut and then pasted or copied and then pasted (value is 1).static final String
DragSource Key: The string constant for looking up the drag source for a control usinggetData(String)
.static final int
DragSource Event: the drop has successfully completed or has been terminated (such as hitting the ESC key); perform cleanup such as removing data on a move operation (value is 2000).static final int
DropTarget Event: the cursor has entered the drop target boundaries (value is 2002).static final int
DropTarget Event: the cursor has left the drop target boundaries OR the drop operation has been cancelled (such as by hitting ECS) OR the drop is about to happen (user has released the mouse button over this target) (value is 2003).static final int
DropTarget Event: the operation being performed has changed usually due to the user changing the selected modifier keys while dragging (value is 2005).static final int
DropTarget Event: the cursor is over the drop target (value is 2004).static final int
DragSource Event: the data to be dropped is required from the drag source (value is 2001).static final int
DragSource Event: a drag is about to begin (value is 2008).static final int
DropTarget Event: the data has been dropped (value is 2006).static final int
Drag and Drop Operation: a copy of the data in the drag source is added to the drop target (value is 1 << 0).static final int
Drag and Drop Operation: During a dragEnter event or a dragOperationChanged, if no modifier keys are pressed, the operation is set to DROP_DEFAULT.static final int
Drag and Drop Operation: the drop target makes a link to the data in the drag source (value is 1 << 2).static final int
Drag and Drop Operation: a copy of the data is added to the drop target and the drag source removes the original data and any references to the data, and updates its display (value is 1 << 1).static final int
Drag and Drop Operation: no drag/drop operation performed (value is 0).static final String
DropTarget Key: The string constant for looking up the drop target for a control usinggetData(String)
.static final int
Drag and Drop Operation: the drop target moves the data and the drag source removes any references to the data and updates its display.static final int
DropTarget Event: the drop target is given a last chance to modify the drop (value is 2007).static final int
Error code: drag source can not be initialized (value is 2000).static final int
Error code: drop target cannot be initialized (value is 2001).static final int
Error code: Data can not be set on system clipboard (value is 2002).static final int
Error code: Data does not have correct format for type (value is 2003).static final int
DropTarget drag under effect: The item currently under the cursor is expanded to allow the user to select a drop target from a sub item; applies to trees (value is 16).static final int
DropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to tables and trees (value is 4).static final int
DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to tables and trees (value is 2).static final int
DropTarget drag under effect: No effect is shown (value is 0).static final int
DropTarget drag under effect: The widget is scrolled up or down to allow the user to drop on items that are not currently visible; applies to tables and trees (value is 8).static final int
DropTarget drag under effect: The item under the cursor is selected; applies to tables and trees (value is 1).static final int
The transfer mechanism for clients that use the selection mechanism (value is 2). -
Constructor Summary
-
Method Summary
-
Field Details
-
CLIPBOARD
public static final int CLIPBOARDThe transfer mechanism for data that is being cut and then pasted or copied and then pasted (value is 1).- Since:
- 3.1
- See Also:
-
SELECTION_CLIPBOARD
public static final int SELECTION_CLIPBOARDThe transfer mechanism for clients that use the selection mechanism (value is 2).- Since:
- 3.1
- See Also:
-
DROP_NONE
public static final int DROP_NONEDrag and Drop Operation: no drag/drop operation performed (value is 0).- See Also:
-
DROP_COPY
public static final int DROP_COPYDrag and Drop Operation: a copy of the data in the drag source is added to the drop target (value is 1 << 0).- See Also:
-
DROP_MOVE
public static final int DROP_MOVEDrag and Drop Operation: a copy of the data is added to the drop target and the drag source removes the original data and any references to the data, and updates its display (value is 1 << 1).Warning: Some applications (most notably Firefox, Thunderbird, and Safari) return
DROP_MOVE
even if they just open a dropped file and don't copy anything, see bug 30543.To avoid data loss, you may want to not remove the original data when you handle a
DragEnd
for aFileTransfer
whoseEvent.detail
isDROP_MOVE
.- See Also:
-
DROP_LINK
public static final int DROP_LINKDrag and Drop Operation: the drop target makes a link to the data in the drag source (value is 1 << 2).- See Also:
-
DROP_TARGET_MOVE
public static final int DROP_TARGET_MOVEDrag and Drop Operation: the drop target moves the data and the drag source removes any references to the data and updates its display. This is not available on all platforms and is only used when a non-SWT application is the drop target. In this case, the SWT drag source is informed in the dragFinished event that the drop target has moved the data. (value is 1 << 3). -
DROP_DEFAULT
public static final int DROP_DEFAULTDrag and Drop Operation: During a dragEnter event or a dragOperationChanged, if no modifier keys are pressed, the operation is set to DROP_DEFAULT. The application can choose what the default operation should be by setting a new value in the operation field. If no value is choosen, the default operation for the platform will be selected (value is 1 << 4). -
DragEnd
public static final int DragEndDragSource Event: the drop has successfully completed or has been terminated (such as hitting the ESC key); perform cleanup such as removing data on a move operation (value is 2000).- See Also:
-
DragSetData
public static final int DragSetDataDragSource Event: the data to be dropped is required from the drag source (value is 2001).- See Also:
-
DragEnter
public static final int DragEnterDropTarget Event: the cursor has entered the drop target boundaries (value is 2002).- See Also:
-
DragLeave
public static final int DragLeaveDropTarget Event: the cursor has left the drop target boundaries OR the drop operation has been cancelled (such as by hitting ECS) OR the drop is about to happen (user has released the mouse button over this target) (value is 2003).- See Also:
-
DragOver
public static final int DragOverDropTarget Event: the cursor is over the drop target (value is 2004).- See Also:
-
DragOperationChanged
public static final int DragOperationChangedDropTarget Event: the operation being performed has changed usually due to the user changing the selected modifier keys while dragging (value is 2005).- See Also:
-
Drop
public static final int DropDropTarget Event: the data has been dropped (value is 2006).- See Also:
-
DropAccept
public static final int DropAcceptDropTarget Event: the drop target is given a last chance to modify the drop (value is 2007).- See Also:
-
DragStart
public static final int DragStartDragSource Event: a drag is about to begin (value is 2008).- See Also:
-
FEEDBACK_NONE
public static final int FEEDBACK_NONEDropTarget drag under effect: No effect is shown (value is 0).- See Also:
-
FEEDBACK_SELECT
public static final int FEEDBACK_SELECTDropTarget drag under effect: The item under the cursor is selected; applies to tables and trees (value is 1).- See Also:
-
FEEDBACK_INSERT_BEFORE
public static final int FEEDBACK_INSERT_BEFOREDropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to tables and trees (value is 2).- See Also:
-
FEEDBACK_INSERT_AFTER
public static final int FEEDBACK_INSERT_AFTERDropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to tables and trees (value is 4).- See Also:
-
FEEDBACK_SCROLL
public static final int FEEDBACK_SCROLLDropTarget drag under effect: The widget is scrolled up or down to allow the user to drop on items that are not currently visible; applies to tables and trees (value is 8).- See Also:
-
FEEDBACK_EXPAND
public static final int FEEDBACK_EXPANDDropTarget drag under effect: The item currently under the cursor is expanded to allow the user to select a drop target from a sub item; applies to trees (value is 16).- See Also:
-
ERROR_CANNOT_INIT_DRAG
public static final int ERROR_CANNOT_INIT_DRAGError code: drag source can not be initialized (value is 2000).- See Also:
-
ERROR_CANNOT_INIT_DROP
public static final int ERROR_CANNOT_INIT_DROPError code: drop target cannot be initialized (value is 2001).- See Also:
-
ERROR_CANNOT_SET_CLIPBOARD
public static final int ERROR_CANNOT_SET_CLIPBOARDError code: Data can not be set on system clipboard (value is 2002).- See Also:
-
ERROR_INVALID_DATA
public static final int ERROR_INVALID_DATAError code: Data does not have correct format for type (value is 2003).- Since:
- 3.1
- See Also:
-
DROP_TARGET_KEY
DropTarget Key: The string constant for looking up the drop target for a control usinggetData(String)
. When a drop target is created for a control, it is stored as a property in the control usingsetData(String, Object)
.- Since:
- 3.4
- See Also:
-
DRAG_SOURCE_KEY
DragSource Key: The string constant for looking up the drag source for a control usinggetData(String)
. When a drag source is created for a control, it is stored as a property in the control usingsetData(String, Object)
.- Since:
- 3.4
- See Also:
-
-
Constructor Details
-
DND
public DND()
-
-
Method Details
-
error
public static void error(int code) Throws an appropriate exception based on the passed in error code.- Parameters:
code
- the DND error code
-
error
public static void error(int code, int hresult) Throws an appropriate exception based on the passed in error code. Thehresult
argument should be either 0, or the platform specific error code.In DND, errors are reported by throwing one of three exceptions:
- java.lang.IllegalArgumentException
- thrown whenever one of the API methods is invoked with an illegal argument
- org.eclipse.swt.SWTException (extends java.lang.RuntimeException)
- thrown whenever a recoverable error happens internally in SWT
- org.eclipse.swt.SWTError (extends java.lang.Error)
- thrown whenever a non-recoverable error happens internally in SWT
This method provides the logic which maps between error codes and one of the above exceptions.
- Parameters:
code
- the DND error code.hresult
- the platform specific error code.- See Also:
-