Top Description Fields Constructors Methods
org.eclipse.swt.dnd

public Class DND

extends Object
Class Inheritance
Imports
org.eclipse.swt.*

Class DND contains all the constants used in defining a DragSource or a DropTarget.
See Also
Sample code and further information

Field Summary

Modifier and TypeField and Description
pack-priv static final String
public static final int
CLIPBOARD

The transfer mechanism for data that is being cut and then pasted or copied and then pasted (value is 1).

public static final String
DRAG_SOURCE_KEY

DragSource Key: The string constant for looking up the drag source for a control using getData(String).

public static final int
DragEnd

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

public static final int
DragEnter

DropTarget Event: the cursor has entered the drop target boundaries (value is 2002).

public static final int
DragLeave

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

public static final int
DragOperationChanged

DropTarget Event: the operation being performed has changed usually due to the user changing the selected modifier keys while dragging (value is 2005).

public static final int
DragOver

DropTarget Event: the cursor is over the drop target (value is 2004).

public static final int
DragSetData

DragSource Event: the data to be dropped is required from the drag source (value is 2001).

public static final int
DragStart

DragSource Event: a drag is about to begin (value is 2008).

public static final int
Drop

DropTarget Event: the data has been dropped (value is 2006).

public static final int
DROP_COPY

Drag and Drop Operation: a copy of the data in the drag source is added to the drop target (value is 1 << 0).

public static final int
DROP_DEFAULT

Drag and Drop Operation: During a dragEnter event or a dragOperationChanged, if no modifier keys are pressed, the operation is set to DROP_DEFAULT.

public static final int
DROP_LINK

Drag and Drop Operation: the drop target makes a link to the data in the drag source (value is 1 << 2).

public static final int
DROP_MOVE

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

public static final int
DROP_NONE

Drag and Drop Operation: no drag/drop operation performed (value is 0).

public static final String
DROP_TARGET_KEY

DropTarget Key: The string constant for looking up the drop target for a control using getData(String).

public static final int
DROP_TARGET_MOVE

Drag and Drop Operation: the drop target moves the data and the drag source removes any references to the data and updates its display.

public static final int
DropAccept

DropTarget Event: the drop target is given a last chance to modify the drop (value is 2007).

public static final int
ERROR_CANNOT_INIT_DRAG

Error code: drag source can not be initialized (value is 2000).

public static final int
ERROR_CANNOT_INIT_DROP

Error code: drop target cannot be initialized (value is 2001).

public static final int
ERROR_CANNOT_SET_CLIPBOARD

Error code: Data can not be set on system clipboard (value is 2002).

public static final int
ERROR_INVALID_DATA

Error code: Data does not have correct format for type (value is 2003).

public static final int
FEEDBACK_EXPAND

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

public static final int
FEEDBACK_INSERT_AFTER

DropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to tables and trees (value is 4).

public static final int
FEEDBACK_INSERT_BEFORE

DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to tables and trees (value is 2).

public static final int
FEEDBACK_NONE

DropTarget drag under effect: No effect is shown (value is 0).

public static final int
FEEDBACK_SCROLL

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

public static final int
FEEDBACK_SELECT

DropTarget drag under effect: The item under the cursor is selected; applies to tables and trees (value is 1).

pack-priv static final String
pack-priv static final String
pack-priv static final String
public static final int
SELECTION_CLIPBOARD

The transfer mechanism for clients that use the selection mechanism (value is 2).

Constructor Summary

AccessConstructor and Description
public
DND()

Method Summary

Modifier and TypeMethod and Description
public static void
error(int
the DND error code
code
)

Throws an appropriate exception based on the passed in error code.

public static void
error(int
the DND error code.
code
,
int
the platform specific error code.
hresult
)

Throws an appropriate exception based on the passed in error code.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CANNOT_SET_CLIPBOARD_MESSAGEback to summary
pack-priv static final String CANNOT_SET_CLIPBOARD_MESSAGE
CLIPBOARDback to summary
public static final int CLIPBOARD

The transfer mechanism for data that is being cut and then pasted or copied and then pasted (value is 1).

Since
3.1
See Also
Clipboard
DRAG_SOURCE_KEYback to summary
public static final String DRAG_SOURCE_KEY

DragSource Key: The string constant for looking up the drag source for a control using getData(String). When a drag source is created for a control, it is stored as a property in the control using setData(String, Object).

Since
3.4
DragEndback to summary
public static final int DragEnd

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

DragEnterback to summary
public static final int DragEnter

DropTarget Event: the cursor has entered the drop target boundaries (value is 2002).

DragLeaveback to summary
public static final int DragLeave

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

DragOperationChangedback to summary
public static final int DragOperationChanged

DropTarget Event: the operation being performed has changed usually due to the user changing the selected modifier keys while dragging (value is 2005).

DragOverback to summary
public static final int DragOver

DropTarget Event: the cursor is over the drop target (value is 2004).

DragSetDataback to summary
public static final int DragSetData

DragSource Event: the data to be dropped is required from the drag source (value is 2001).

DragStartback to summary
public static final int DragStart

DragSource Event: a drag is about to begin (value is 2008).

Dropback to summary
public static final int Drop

DropTarget Event: the data has been dropped (value is 2006).

DROP_COPYback to summary
public static final int DROP_COPY

Drag and Drop Operation: a copy of the data in the drag source is added to the drop target (value is 1 << 0).

DROP_DEFAULTback to summary
public static final int DROP_DEFAULT

Drag 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).

Since
2.0
See Also
DropTargetListener#dragEnter, DropTargetListener#dragOperationChanged
DROP_MOVEback to summary
public static final int DROP_MOVE

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

Warning

Some applications (most notably Firefox, Thunderbird, and Safari) return DND#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 DND#DragEnd for a FileTransfer whose org.eclipse.swt.widgets.Event#detail is DROP_MOVE.

DROP_NONEback to summary
public static final int DROP_NONE

Drag and Drop Operation: no drag/drop operation performed (value is 0).

DROP_TARGET_KEYback to summary
public static final String DROP_TARGET_KEY

DropTarget Key: The string constant for looking up the drop target for a control using getData(String). When a drop target is created for a control, it is stored as a property in the control using setData(String, Object).

Since
3.4
DROP_TARGET_MOVEback to summary
public static final int DROP_TARGET_MOVE

Drag 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).

See Also
DragSourceListener#dragFinished
DropAcceptback to summary
public static final int DropAccept

DropTarget Event: the drop target is given a last chance to modify the drop (value is 2007).

ERROR_CANNOT_INIT_DRAGback to summary
public static final int ERROR_CANNOT_INIT_DRAG

Error code: drag source can not be initialized (value is 2000).

ERROR_CANNOT_INIT_DROPback to summary
public static final int ERROR_CANNOT_INIT_DROP

Error code: drop target cannot be initialized (value is 2001).

ERROR_CANNOT_SET_CLIPBOARDback to summary
public static final int ERROR_CANNOT_SET_CLIPBOARD

Error code: Data can not be set on system clipboard (value is 2002).

ERROR_INVALID_DATAback to summary
public static final int ERROR_INVALID_DATA

Error code: Data does not have correct format for type (value is 2003).

Since
3.1
FEEDBACK_EXPANDback to summary
public static final int FEEDBACK_EXPAND

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

FEEDBACK_INSERT_AFTERback to summary
public static final int FEEDBACK_INSERT_AFTER

DropTarget drag under effect: An insertion mark is shown after the item under the cursor; applies to tables and trees (value is 4).

FEEDBACK_INSERT_BEFOREback to summary
public static final int FEEDBACK_INSERT_BEFORE

DropTarget drag under effect: An insertion mark is shown before the item under the cursor; applies to tables and trees (value is 2).

FEEDBACK_NONEback to summary
public static final int FEEDBACK_NONE

DropTarget drag under effect: No effect is shown (value is 0).

FEEDBACK_SCROLLback to summary
public static final int FEEDBACK_SCROLL

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

FEEDBACK_SELECTback to summary
public static final int FEEDBACK_SELECT

DropTarget drag under effect: The item under the cursor is selected; applies to tables and trees (value is 1).

INIT_DRAG_MESSAGEback to summary
pack-priv static final String INIT_DRAG_MESSAGE
INIT_DROP_MESSAGEback to summary
pack-priv static final String INIT_DROP_MESSAGE
INVALID_DATA_MESSAGEback to summary
pack-priv static final String INVALID_DATA_MESSAGE
SELECTION_CLIPBOARDback to summary
public static final int SELECTION_CLIPBOARD

The transfer mechanism for clients that use the selection mechanism (value is 2).

Since
3.1
See Also
Clipboard

Constructor Detail

DNDback to summary
public DND()

Method Detail

errorback to summary
public static void error(int code)

Throws an appropriate exception based on the passed in error code.

Parameters
code:int

the DND error code

errorback to summary
public static void error(int code, int hresult)

Throws an appropriate exception based on the passed in error code. The hresult 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:int

the DND error code.

hresult:int

the platform specific error code.

See Also
SWTError, SWTException, IllegalArgumentException