Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop')
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java131
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java17
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java78
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java12
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java66
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java69
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java18
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java97
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java171
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java14
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java73
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java142
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java133
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java69
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java92
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java28
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java73
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java142
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java133
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java59
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java69
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java52
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java68
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java57
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java35
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java92
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java206
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java482
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java602
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java100
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java77
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java101
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java76
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java62
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java35
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java214
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java58
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java167
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java215
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java223
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java65
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java75
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java63
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java75
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java56
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java32
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java102
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java132
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java353
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java482
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java609
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java142
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java156
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java79
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java116
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java114
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java92
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java53
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java214
68 files changed, 0 insertions, 8002 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java
deleted file mode 100755
index 3e3bcba80b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DND.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-
-/**
- *
- * Class DND contains all the constants used in defining a
- * DragSource or a DropTarget.
- *
- */
-
-
-public class DND {
-
- /**
- * Drag and Drop Operation: no drag/drop operation is performed
- */
- public final static int DROP_NONE = 0;
- /**
- * Drag and Drop Operation: a copy of the data in the drag source is added to the drop target
- */
- public final static int DROP_COPY = 1;
- /**
- * Drag and Drop Operation: the data is added to the drop target and removed from the drag source
- */
- public final static int DROP_MOVE = 2;
- /**
- * Drag and Drop Operation: the drop target makes a link to the data in the drag source
- */
- public final static int DROP_LINK = 4;
-
- public final static int DROP_TARGET_MOVE = 5;
- /**
- * 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
- */
- public static final int DragEnd = 2000;
- /**
- * DragSource Event: the data to be dropped is required from the drag source
- */
- public static final int DragSetData = 2001;
- /**
- * DropTarget Event: the cursor has entered the drop target boundaries
- */
- public static final int DragEnter = 2002;
- /**
- * DropTarget Event: the cursor has left the drop target boundaries
- */
- public static final int DragLeave = 2003;
- /**
- * DropTarget Event: the cursor is moving over the drop target
- */
- public static final int DragOver = 2004;
- /**
- * DropTarget Event: the operation being performed has changed
- * (usually due to the user changing the selected key while dragging)
- */
- public static final int DragOperationChanged = 2005;
- /**
- * DropTarget Event: the data is being dropped
- */
- public static final int Drop = 2006;
- /**
- * DropTarget Event: the drop target is given a last chance to modify the drop
- */
- public static final int DropAccept = 2007;
- /**
- * DragSource Event: a drag is about to begin
- */
- public static final int DragStart = 2008;
-
- public static final int FEEDBACK_NONE = 0;
- public static final int FEEDBACK_SELECT = 1;
- public static final int FEEDBACK_INSERT_BEFORE = 2;
- public static final int FEEDBACK_INSERT_AFTER = 4;
- public static final int FEEDBACK_SCROLL = 8;
- public static final int FEEDBACK_EXPAND = 16;
-
-
- /**
- * Error code for SWTError - drag source can not be initialized
- */
- public static final int ERROR_CANNOT_INIT_DRAG = 2000;
- /**
- * Error code for SWTError - drop target cannot be initialized
- */
- public static final int ERROR_CANNOT_INIT_DROP = 2001;
- /**
- * Error code for SWTError - Data can not be set on system clipboard
- */
- public static final int ERROR_CANNOT_SET_CLIPBOARD = 2002;
-
-
- static final String INIT_DRAG_MESSAGE = "Can not initialize Drag";
- static final String INIT_DROP_MESSAGE = "Can not initialize Drop";
- static final String CANNOT_SET_CLIPBOARD_MESSAGE = "Can not set data in clipboard";
-
-public static void error (int code) {
- error (code, 0);
-}
-
-public static void error (int code, int hresult) {
- switch (code) {
- /* OS Failure/Limit (fatal, may occur only on some platforms) */
- case DND.ERROR_CANNOT_INIT_DRAG:{
- String msg = DND.INIT_DRAG_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- case DND.ERROR_CANNOT_INIT_DROP:{
- String msg = DND.INIT_DROP_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- case DND.ERROR_CANNOT_SET_CLIPBOARD:{
- String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE;
- if (hresult != 0) msg += "result = "+hresult;
- throw new SWTError (code, msg);
- }
- }
-
- /* Unknown/Undefined Error */
- SWT.error(code);
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
deleted file mode 100755
index e0dfd61d96..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDEvent.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-class DNDEvent extends Event {
-
- public TransferData dataType;
- public TransferData[] dataTypes;
- public int operations;
- public int feedback;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java
deleted file mode 100755
index 8c20b7365b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DNDListener.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.internal.SWTEventListener;
-
-
-class DNDListener extends org.eclipse.swt.widgets.TypedListener {
-/**
- * DNDListener constructor comment.
- * @param listener org.eclipse.swt.internal.SWTEventListener
- */
-DNDListener(SWTEventListener listener) {
- super(listener);
-}
-public void handleEvent (Event e) {
- switch (e.type) {
- case DND.DragStart: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragStart (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragEnd: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragFinished (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragSetData: {
- DragSourceEvent event = new DragSourceEvent((DNDEvent)e);
- ((DragSourceListener) eventListener).dragSetData (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragEnter: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragEnter (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragLeave: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragLeave (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragOver: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragOver (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.Drop: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).drop (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DropAccept: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dropAccept (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
- case DND.DragOperationChanged: {
- DropTargetEvent event = new DropTargetEvent((DNDEvent)e);
- ((DropTargetListener) eventListener).dragOperationChanged (event);
- event.updateEvent((DNDEvent)e);
- break;
- }
-
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java
deleted file mode 100755
index 30a349cafd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceAdapter.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DragSourceAdapter implements DragSourceListener {
- public void dragStart(DragSourceEvent event){};
- public void dragFinished(DragSourceEvent event){};
- public void dragSetData(DragSourceEvent event){};
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
deleted file mode 100755
index f47370a7c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceEvent.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.events.TypedEvent;
-
-/**
- * The DragSourceEvent contains the event information passed in the methods of the DragSourceListener.
- *
- * <p>dragStart : When a drag operation is about to being, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that is initiating the drag
- * <li>time - (in) the time the drag action occurred
- * <li>doit - (out) the application can set this value to false to prevent the drag from starting. Set to true by default.
- * </ul></p>
- *
- * <p>dragSetData : When requesting data from the DragSource, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>dataType - (in) the type of data requested. This is a TransferData object and can be used with the Transfer subclasses.
- * <li>data - (out) the application inserts the actual data here (must match the dataType). This is a Java object and
- * the type of Java object that the application should insert here depends on the data type.
- * For example, a TextTransfer requires a Java String containing the text; a FileTransfer requires
- * a Java array of String with each String in the array representing the full path of the file.
- * To determine what type of object you need to place in this field, consult the description of
- * the Transfer subclass
- * </ul></p>
- *
- * <p>dragFinished : When a drag operation has been completed, the following fields apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (in) true if the operation performed successfully
- * <li>detail - (in) the operation that was performed (DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- */
-
-public class DragSourceEvent extends TypedEvent {
- public int detail;
- public boolean doit;
-
- /**
- * Platform specific information about the type of data being transferred.
- */
- public TransferData dataType;
-
-public DragSourceEvent(DNDEvent e) {
- super(e);
- this.data = e.data;
- this.detail = e.detail;
- this.doit = e.doit;
- this.dataType = e.dataType;
-}
-void updateEvent(DNDEvent e) {
- e.widget = this.widget;
- e.time = this.time;
- e.data = this.data;
- e.detail = this.detail;
- e.doit = this.doit;
- e.dataType = this.dataType;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java
deleted file mode 100755
index d952888812..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragSourceListener.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * The <code>DragSourceListener</code> class provides event notification to the application for DragSource events.
- *
- * <p>When the user drops data on a <code>DropTarget</code>, the application which defines the <code>DragSource</code>
- * must provide the dropped data by implementing <code>dragSetData</code>.</p>
- *
- * <p>After the drop has completed successfully or has been aborted, the application which defines the
- * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful
- * <b>move</b> operation, the application must remove the data that was transferred.</p>
- *
- */
-public interface DragSourceListener extends SWTEventListener {
-
-/**
- * The user has begun the actions required to drag the widget. This event gives the application
- * the chance to decide if a drag should be started.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (out) set to fase by default. To cause a drag to begin, set this to true.
- * </ul></p>
- *
- * @param event the information associated with the drag finished event
- *
- */
-public void dragStart(DragSourceEvent event);
-
-/**
- * The data is required from the drag source.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>dataType - (in) the type of data requested. This is a TransferData object and can be used with the Transfer subclasses.
- * <li>data - (out) the application inserts the actual data here (must match the dataType)
- * </ul></p>
- *
- * @param event the information associated with the drag set data event
- */
-public void dragSetData(DragSourceEvent event);
-
-/**
- * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting
- * the ESC key). Perform cleanup such as removing data from the source side on a successful move operation.
- *
- * <p>The following fields in the DragSourceEvent apply:
- * <ul>
- * <li>widget - (in) the DragSource object that initiated the drag
- * <li>time - (in) the time the drop occurred
- * <li>doit - (in) true if the operation performed successfully
- * <li>detail - (in) the operation that was performed (DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * @param event the information associated with the drag finished event
- *
- */
-public void dragFinished(DragSourceEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java
deleted file mode 100755
index fc55ade742..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DragUnderEffect.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-abstract class DragUnderEffect {
-
-abstract void show(int effect, int x, int y);
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java
deleted file mode 100755
index 2b551b138c..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetAdapter.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-public class DropTargetAdapter implements DropTargetListener {
-
-public void dragEnter(DropTargetEvent event){};
-public void dragLeave(DropTargetEvent event){};
-public void dragOperationChanged(DropTargetEvent event){};
-public void dragOver(DropTargetEvent event){};
-public void drop(DropTargetEvent event){};
-public void dropAccept(DropTargetEvent event){};
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
deleted file mode 100755
index 19dff63554..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetEvent.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * The DropTargetEvent contains the event information passed in the methods of the DropTargetListener.
- *
- * <p>When in dragEnter(), dragOver(), dragLeave(), dragOperationChanged(), dropAccept(),
- * the following fields apply:
- * <ul>
- * <li>(in)widget - the object on which the data will be dropped if the mouse is released
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the DropTarget <code>Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the DropTarget <code>Control</code>
- * <li>(in)dataTypes - a list of the types of data that the DragSource can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided on a drop
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul>
- * The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes list</code>.</p>
- *
- * <p>When in drop(), the following fields apply:
- * <ul>
- * <li>(in)widget - the object on which the data was dropped
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>Display</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>Display</code>
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * <li>(in)currentDataType - the specific type of data that is be contained in the <code>data</code> field
- * <li>(in)data - the data (which is of type currentDataType); the type Java Object contained in this field is
- * dependant on the Transfer subclass. For example, the TextTransfer subclass provides a
- * String with the text in the String. The FileTransfer object provides an array of String with
- * each String in the array containing the full path of the file.
- * </ul>
- * The application can cancel the drop operation by setting the detail field to DND.DROP_NONE.</p>
- *
- */
-public class DropTargetEvent extends TypedEvent {
- public int x;
- public int y;
- public int detail;
- /**
- * A list of the operations that the DragSource can support
- * (e.g. DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK).
- */
- public int operations;
- public int feedback;
- public Widget item;
-
- /*
- * Platform specfic data.
- */
- /**
- * The type of data that will be dropped.
- */
- public TransferData currentDataType;
- /**
- * A list of the types of data that the DragSource is capable of providing.
- * The currentDataType must be a member of this list.
- */
- public TransferData[] dataTypes;
-
-
-public DropTargetEvent(DNDEvent e) {
- super(e);
- this.data = e.data;
- this.x = e.x;
- this.y = e.y;
- this.detail = e.detail;
- this.currentDataType = e.dataType;
- this.dataTypes = e.dataTypes;
- this.operations = e.operations;
- this.feedback = e.feedback;
- this.item = e.item;
-}
-void updateEvent(DNDEvent e) {
- e.widget = this.widget;
- e.time = this.time;
- e.data = this.data;
- e.x = this.x;
- e.y = this.y;
- e.detail = this.detail;
- e.dataType = this.currentDataType;
- e.dataTypes = this.dataTypes;
- e.operations = this.operations;
- e.feedback = this.feedback;
- e.item = this.item;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java
deleted file mode 100755
index 5defa79fe2..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/DropTargetListener.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.internal.SWTEventListener;
-
-/**
- * The <code>DropTargetListener</code> class provides event notification to the application for DropTarget events.
- *
- * <p>As the user moves the cursor into, over and out of a Control that has been designated as a DropTarget, events
- * indicate what operation can be performed and what data can be transferred if a drop where to occur at that point.
- * The application can respond to these events and change the type of data that will be dropped, change the operation
- * that will be performed or stop any drop from happening on the current target.</p>
- *
- * <p>When the user causes a drop to happen by releasing the mouse over a valid drop target, the application has one
- * last chance to change the data type of the drop through the DropAccept event. If the drop is still allowed, the
- * DropAccept event is immediately followed by the Drop event. In the Drop event, the application can still change the
- * operation that is performed but the data type is fixed.</p>
- *
- */
-public interface DropTargetListener extends SWTEventListener {
-/**
- * The cursor has entered the drop target boundaries.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag enter event
- *
- */
-public void dragEnter(DropTargetEvent event);
-/**
- * The cursor has left the drop target boundaries.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag leave event
- *
- */
-
-public void dragLeave(DropTargetEvent event);
-/**
- * The operation being performed has changed (usually due to the user changing the selected key while dragging).
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag operation changed event
- */
-
-public void dragOperationChanged(DropTargetEvent event);
-/**
- * The cursor is moving over the drop target.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drag over event
- *
- */
-
-public void dragOver(DropTargetEvent event);
-/**
- * The data is being dropped.
- *
- * <p>The following fields in DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * <li>(in)currentDataType - the specific type of data that will be provided
- * <li>(in)data - the data (which is of type currentDataType)
- * </ul></p>
- *
- * <p>The application can refuse to perform the drop operation by setting the detail field to DND.DROP_NONE.</p>
- *
- * @param event the information associated with the drop event
- *
- */
-
-public void drop(DropTargetEvent event);
-/**
- * The drop target is given the chance to change the nature of the drop. It can veto the drop by setting the
- * <code>event.detail</code> field to <code>DND.DROP_NONE</code>, it can change the data of data that will be
- * dropped by setting the <code>event.currentDataType</code> field to a different value or it can change the
- * operation that will be performed by changing the <code>event.detail</code> field.
- *
- * <p>The following fields in the DropTargetEvent apply:
- * <ul>
- * <li>(in)widget - the DragSource object that initiated the drag
- * <li>(in)time - the time the drop occurred
- * <li>(in)x - the x-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)y - the y-cordinate of the cursor relative to the <code>DropTarget Control</code>
- * <li>(in)dataTypes - a list of the types of data that the <code>DragSource</code> can support
- * <li>(in,out)currentDataType - the specific type of data that will be provided
- * <li>(in)operations - a list of the operations that the DragSource can support (e.g. <code>DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK</code>)
- * <li>(in,out)detail - the operation being performed (one of DND.DROP_MOVE, DND.DROP_COPY, DND.DROP_LINK, DND.DROP_NONE)
- * </ul></p>
- *
- * <p>The application can change the operation that will be performed by modifying the <code>detail</code> field
- * but the choice must be one of the values in the <code>operations</code> field.
- * The application can also change the type of data being requested by modifying the <code>currentDataTypes</code>
- * field but the value must be one of the values in the <code>dataTypes</code> list.</p>
- *
- * @param event the information associated with the drop accept event
- *
- */
-public void dropAccept(DropTargetEvent event);
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java
deleted file mode 100755
index d3d854a3e7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/NoDragUnderEffect.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.widgets.*;
-
-class NoDragUnderEffect extends DragUnderEffect {
-
-NoDragUnderEffect(Control control) {}
-void show(int effect, int x, int y){}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html
deleted file mode 100755
index e2adf9d6c8..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/common/org/eclipse/swt/dnd/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
- <html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-SWT Drag and Drop support.
-<h2>
-Package Specification</h2>
-This package contains the classes which make up the public API of the SWT Drag and Drop support.
-</body>
-</html>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100644
index c8c5e4a05a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- return null;
-}
-public boolean isSupportedType(TransferData transferData){
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100644
index b368acb214..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
- return display.getData("TextTransfer");
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- for (int i = 0; i < transferAgents.length; i++) {
- if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
- display.setData("TextTransfer", data[i]);
- return;
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100644
index 1c41d9e326..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public final class DragSource extends Widget {
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, style);
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
-
-}
-
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-/**
- * @deprecated - use DragSourceListener.dragStart
- */
-public void startDrag() {
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100644
index 1be0fe0207..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public final class DropTarget extends Widget {
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
- super(control, style);
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
-}
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return null;
-}
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer() { return null; }
-public void notifyListener (int eventType, Event event) {}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100644
index a3f240b7a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return null;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- return null;
-}
-protected String[] getTypeNames(){
- return null;
-}
-protected int[] getTypeIds(){
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100644
index 490afaebc7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100644
index 6862a2ea48..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- return table.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100644
index d84cbfe40a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100644
index 9dcf84ff27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100644
index bade8baef0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100644
index 54ff723827..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- return tree.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100644
index c8c5e4a05a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- return null;
-}
-public boolean isSupportedType(TransferData transferData){
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100644
index b368acb214..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() || !(transfer instanceof TextTransfer)) return null;
- return display.getData("TextTransfer");
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- for (int i = 0; i < transferAgents.length; i++) {
- if (transferAgents[i] instanceof TextTransfer && data[i] instanceof String){
- display.setData("TextTransfer", data[i]);
- return;
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100644
index 1c41d9e326..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public final class DragSource extends Widget {
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, style);
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
-
-}
-
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return null;
-}
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-/**
- * @deprecated - use DragSourceListener.dragStart
- */
-public void startDrag() {
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100644
index 1be0fe0207..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.gtk.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public final class DropTarget extends Widget {
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
- super(control, style);
-}
-
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
-}
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return null;
-}
-public Display getDisplay () {
- return null;
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer() { return null; }
-public void notifyListener (int eventType, Event event) {}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100644
index a3f240b7a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return null;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- return null;
-}
-protected String[] getTypeNames(){
- return null;
-}
-protected int[] getTypeIds(){
- return null;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100644
index 490afaebc7..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100644
index 6862a2ea48..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- return table.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100644
index d84cbfe40a..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100644
index 9dcf84ff27..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.gtk.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100644
index bade8baef0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100644
index 54ff723827..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk1x/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- return tree.getItem(coordinates);
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index de4a1159a9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.motif.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- }
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- if (transferData.type == types[i]) return true;
- }
- return false;
-}
-protected void javaToNative (Object object, TransferData transferData){
- if ((object == null) || !(object instanceof byte[]) || !(isSupportedType(transferData))) {
- transferData.result = 0;
- return;
- }
- byte[] buffer = (byte[])object;
- transferData.pValue = OS.XtMalloc(buffer.length + 1);
- OS.memmove(transferData.pValue, buffer, buffer.length);
- transferData.length = buffer.length;
- transferData.format = 8;
- transferData.result = 1;
-}
-protected Object nativeToJava(TransferData transferData){
-
- if (transferData.pValue == 0 || !(isSupportedType(transferData))) return null;
-
- int size = transferData.format * transferData.length / 8;
- byte[] buffer = new byte[size];
- OS.memmove(buffer, transferData.pValue, size);
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 4bf7a126ff..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
- private final int MAX_RETRIES = 10;
- private int shellHandle;
-
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-
- int widgetClass = OS.TopLevelShellWidgetClass ();
- shellHandle = OS.XtAppCreateShell (null, null, widgetClass, display.xDisplay, null, 0);
- OS.XtSetMappedWhenManaged (shellHandle, false);
- OS.XtRealizeWidget (shellHandle);
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- if (shellHandle != 0) OS.XtDestroyWidget (shellHandle);
- shellHandle = 0;
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() ) return null;
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0) return null;
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0) return null;
-
- // Open clipboard for retrieval
- int retries = 0;
- int status = OS.XmClipboardStartRetrieve(xDisplay, xWindow, OS.XtLastTimestampProcessed(xDisplay));
- while ( status == OS.XmClipboardLocked && retries < MAX_RETRIES) {
- retries ++;
- status = OS.XmClipboardStartRetrieve(xDisplay, xWindow, OS.XtLastTimestampProcessed(xDisplay));
- };
- if (status != OS.XmClipboardSuccess) return null;
-
- // Does Clipboard have data in required format?
- String type = null;
- int[] length = new int[1];
- String[] supportedTypes = transfer.getTypeNames();
- for (int i = 0; i < supportedTypes.length; i++) {
- if (OS.XmClipboardInquireLength(xDisplay, xWindow, supportedTypes[i].getBytes(), length) == 1 /*OS.XmClipboardSuccess*/ ) {
- type = supportedTypes[i];
- break;
- }
- }
-
- // Retrieve data from Clipboard
- byte[] data = null;
- if (type != null) {
- data = new byte[length[0]];
- status = OS.XmClipboardRetrieve(xDisplay, xWindow, type.getBytes(), data, length[0], new int[1], new int[1]);
- if (status != OS.XmClipboardSuccess) {
- data = null;
- }
- }
-
- // Close Clipboard
- status = OS.XmClipboardEndRetrieve(xDisplay, xWindow);
-
- if (data == null) return null;
-
- // Pass data to transfer agent for conversion to a Java Object
- // Memory is allocated here to emulate the way Drag and Drop transfers data.
- TransferData transferData = new TransferData();
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, type, false);
- transferData.type = OS.XmInternAtom (xDisplay, bName, false);
- transferData.pValue = OS.XtMalloc(data.length);
- OS.memmove(transferData.pValue, data, data.length);
- transferData.length = data.length;
- transferData.format = 8;
- transferData.result = 1;
-
- Object result = transfer.nativeToJava(transferData);
-
- // Clean up allocated memory
- OS.XtFree(transferData.pValue);
-
- return result;
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
-
- if (data == null) {
- DND.error(SWT.ERROR_NOT_IMPLEMENTED);
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (display.isDisposed() )
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- // Open clipboard for setting
- int[] item_id = new int[1];
- int retries = 0;
- int status = OS.XmClipboardStartCopy(xDisplay, xWindow, 0, OS.XtLastTimestampProcessed(xDisplay), shellHandle, 0, item_id);
- while ( status == OS.XmClipboardLocked && retries < MAX_RETRIES) {
- retries ++;
- status = OS.XmClipboardStartCopy(xDisplay, xWindow, 0, OS.XtLastTimestampProcessed(xDisplay), shellHandle, 0, item_id);
- };
- if (status != OS.XmClipboardSuccess)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
- // copy data directly over to System clipboard (not deferred)
- for (int i = 0; i < transferAgents.length; i++) {
- String[] names = transferAgents[i].getTypeNames();
- for (int j = 0; j < names.length; j++) {
-
- TransferData transferData = new TransferData();
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, names[j], false);
- transferData.type = OS.XmInternAtom (xDisplay, bName, false);
- transferAgents[i].javaToNative(data[i], transferData);
- status = OS.XmClipboardFail;
- if (transferData.result == 1 && transferData.format == 8){
- byte[] buffer = new byte[transferData.length];
- OS.memmove(buffer, transferData.pValue, transferData.length);
- status = OS.XmClipboardCopy(xDisplay, xWindow, item_id[0], bName, buffer, transferData.length, 0, null);
- }
- // Clean up allocated memory
- if (transferData.pValue != 0) {
- OS.XtFree(transferData.pValue);
- }
- }
- }
-
- // close clipboard for setting
- OS.XmClipboardEndCopy(xDisplay, xWindow, item_id[0]);
-
- if (status != OS.XmClipboardSuccess)
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
-
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- int[] count = new int[1];
- int[] max_length = new int[1];
- int xDisplay = OS.XtDisplay (shellHandle);
- if (xDisplay == 0)
- DND.error(SWT.ERROR_UNSPECIFIED);
- int xWindow = OS.XtWindow (shellHandle);
- if (xWindow == 0)
- DND.error(SWT.ERROR_UNSPECIFIED);
- if (OS.XmClipboardInquireCount(xDisplay, xWindow, count, max_length) != OS.XmClipboardSuccess)
- DND.error(SWT.ERROR_UNSPECIFIED);
- String[] types = new String[count[0]];
- for (int i = 0; i < count[0]; i++) {
- byte[] buffer = new byte[max_length[0]];
- int[] copied_length = new int[1];
- int rc = OS.XmClipboardInquireFormat(xDisplay, xWindow, i + 1, buffer, buffer.length, copied_length);
- if (rc == OS.XmClipboardNoData){
- types[i] = "";
- continue;
- }
- if (rc != OS.XmClipboardSuccess)
- DND.error(SWT.ERROR_UNSPECIFIED);
- byte[] buffer2 = new byte[copied_length[0]];
- System.arraycopy(buffer, 0, buffer2, 0, copied_length[0]);
- types[i] = new String(buffer2);
- }
- return types;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 38b3e08568..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,482 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public class DragSource extends Widget {
-
- private Callback convertProc;
- private Callback dragDropFinish;
- private Callback dropFinish;
-
- // info for registering as a drag source
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- private boolean moveRequested;
-
- int dragContext;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose) {
- if (!DragSource.this.isDisposed()){
- DragSource.this.dispose();
- }
- }
- if (event.type == SWT.DragDetect){
- DragSource.this.drag();
- }
-
- }
- };
- this.control.addListener (SWT.Dispose, controlListener);
- this.control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragSetData, typedListener);
- addListener (DND.DragEnd, typedListener);
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private int convertProcCallback(int widget, int pSelection, int pTarget, int pType_return, int ppValue_return, int pLength_return, int pFormat_return, int max_length, int client_data, int request_id) {
- /*
- pSelection - atom specifying which property is being used to transfer the selection (only support _MOTIF_DROP)
- pTarget - atom specifying the type in which the requestor wants the information
- pType_return - [out] type atom that data has been converted to (usually the same as pTarget)
- ppValue_return - [out] set to a pointer to a block of memory
- pLength_return - [out] number of elements in the array
- pFormat_return - [out] size in bits of each element in the array
-
- */
-
- if (pSelection == 0 )
- return 0;
-
- // is this a drop?
- int[] selection = new int[1];
- OS.memmove(selection, pSelection, 4);
- int motifDropAtom = Transfer.registerType("_MOTIF_DROP\0");
- if (selection[0] != motifDropAtom) return 0;
-
- // get the target value from pTarget
- int[] target = new int[1];
- OS.memmove(target, pTarget, 4);
-
- // handle the "Move" case
- if (target[0] == Transfer.registerType("DELETE\0")) { // DELETE corresponds to a Move request
- moveRequested = true;
- OS.memmove(pType_return,new int[]{Transfer.registerType("NULL\0")}, 4);
- OS.memmove(ppValue_return, new int[]{0}, 4);
- OS.memmove(pLength_return, new int[]{0}, 4);
- OS.memmove(pFormat_return, new int[]{8}, 4);
- return 1;
- }
-
- // do we support the requested data type?
- boolean dataMatch = true;
- TransferData transferData = new TransferData();
- transferData.type = target[0];
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- dataMatch = true;
- break;
- }
- }
- if (!dataMatch) return 0;
-
- DNDEvent event = new DNDEvent();
- event.widget = control;
- //event.time = ??;
- event.dataType = transferData;
- try {
- notifyListeners(DND.DragSetData,event);
- } catch (Throwable err) {
- return 0;
- }
-
- if (event.data == null) return 0;
-
- Transfer transferAgent = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferAgent = transferAgents[i];
- break;
- }
- }
- if (transferAgent == null) return 0;
-
- transferAgent.javaToNative(event.data, transferData);
- if (transferData.result == 1){
- OS.memmove(ppValue_return, new int[]{transferData.pValue}, 4);
- OS.memmove(pType_return, new int[]{transferData.type}, 4);
- OS.memmove(pLength_return, new int[]{transferData.length}, 4);
- OS.memmove(pFormat_return, new int[]{transferData.format}, 4);
- return 1;
- } else {
- OS.memmove(ppValue_return, new int[]{0}, 4);
- OS.memmove(pLength_return, new int[]{0}, 4);
- OS.memmove(pFormat_return, new int[]{8}, 4);
- return 0;
- }
-}
-private void drag() {
- if (transferAgents == null)
- return;
-
- // Current event must be a Button Press event
- Display display = control.getDisplay ();
- if (display.xEvent.type != OS.ButtonPress) return;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = display.xEvent.pad2;
- event.doit = true;
-
- try {
- notifyListeners(DND.DragStart, event);
- } catch (Throwable e) {
- event.doit = false;
- }
-
- if (!event.doit) {
- int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
- int dc = OS.XmGetDragContext(control.handle, time);
- if (dc != 0){
- OS.XmDragCancel(dc);
- }
- return;
- }
-
- // set the protocol (optional)
- // not implemented
-
- // create pixmaps for icons (optional)
- // not implemented
-
- // Copy targets to global memory
- TransferData[] transferData = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] data = transferAgents[i].getSupportedTypes();
- TransferData[] newTransferData = new TransferData[transferData.length + data.length];
- System.arraycopy(transferData, 0, newTransferData, 0, transferData.length);
- System.arraycopy(data, 0, newTransferData, transferData.length, data.length);
- transferData = newTransferData;
- }
- int[] dataTypes = new int[transferData.length];
- for (int i = 0; i < transferData.length; i++){
- dataTypes[i] = transferData[i].type;
- }
- int pExportTargets = OS.XtMalloc(dataTypes.length * 4);
- OS.memmove(pExportTargets, dataTypes, dataTypes.length * 4);
-
- if (convertProc == null)
- convertProc = new Callback(this, "convertProcCallback", 10);
- if (convertProc == null) return;
-
- int[] args = new int[]{
- OS.XmNexportTargets, pExportTargets,
- OS.XmNnumExportTargets, dataTypes.length,
- OS.XmNdragOperations, opToOsOp(getStyle()),
- OS.XmNconvertProc, convertProc.getAddress(),
- OS.XmNoperationCursorIcon, 0,
- OS.XmNsourceCursorIcon, 0,
- OS.XmNstateCursorIcon, 0,
- OS.XmNclientData, 0,
- OS.XmNblendModel, OS.XmBLEND_ALL
- };
-
- // look for existing drag contexts
- int time = display.xEvent.pad2; // corresponds to time field in XButtonEvent
- dragContext = OS.XmGetDragContext(control.handle, time);
- if (dragContext != 0){
- OS.XtSetValues(dragContext, args, args.length /2);
- } else {
- dragContext = OS.XmDragStart(this.control.handle, display.xEvent, args, args.length / 2);
- }
- OS.XtFree(pExportTargets);
- if (dragContext == 0) return;
-
- // register a call back to clean up when drop is done (optional)
- if (dragDropFinish == null)
- dragDropFinish = new Callback(this, "dragDropFinishCallback", 3);
- OS.XtAddCallback(dragContext, OS.XmNdragDropFinishCallback, dragDropFinish.getAddress(), 0);
-
- // register a call back to tell user what happened (optional)
- if (dropFinish == null)
- dropFinish = new Callback(this, "dropFinishCallback", 3);
- OS.XtAddCallback(dragContext, OS.XmNdropFinishCallback, dropFinish.getAddress(), 0);
- return;
-}
-
-private int dragDropFinishCallback(int widget, int client_data, int call_data) {
-
- // uncomment the following code when we allow users to specify their own source icons
- // release the pre set source icon
- //int pSourceIcon = OS.XtMalloc(4);
- //int[] args = new int[]{OS.XmNsourceCursorIcon, pSourceIcon};
- //OS.XtGetValues(control.handle, args, args.length / 2);
- //int[] sourceIcon = new int[1];
- //OS.memmove(sourceIcon, pSourceIcon, 4);
- //if (sourceIcon[0] != 0)
- //OS.XtDestroyWidget(sourceIcon[0]);
- //OS.XtFree(pSourceIcon);
-
- dragContext = 0;
-
- if (convertProc != null)
- convertProc.dispose();
- convertProc = null;
-
- if (dragDropFinish != null)
- dragDropFinish.dispose();
- dragDropFinish = null;
-
- if (dropFinish != null)
- dropFinish.dispose();
- dropFinish = null;
-
- return 0;
-}
-private int dropFinishCallback(int widget, int client_data, int call_data) {
-
- XmDropFinishCallback data = new XmDropFinishCallback();
- OS.memmove(data, call_data, XmDropFinishCallback.sizeof);
-
- if (data.dropAction != OS.XmDROP || data.dropSiteStatus != OS.XmDROP_SITE_VALID) return 0;
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = data.timeStamp;
- if (moveRequested) {
- event.detail = DND.DROP_MOVE;
- } else {
- if (data.operation == OS.XmDROP_MOVE) {
- event.detail = DND.DROP_NONE;
- } else {
- event.detail = osOpToOp(data.operation);
- }
-
- }
- event.doit = (data.completionStatus != 0);
-
- try {
- notifyListeners(DND.DragEnd,event);
- } catch (Throwable err) {
- }
-
- moveRequested = false;
-
- return 0;
-}
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-private void onDispose() {
- if (convertProc != null)
- convertProc.dispose();
- convertProc = null;
-
- if (dragDropFinish != null)
- dragDropFinish.dispose();
- dragDropFinish = null;
-
- if (dropFinish != null)
- dropFinish.dispose();
- dropFinish = null;
-
- if (control != null && controlListener != null) {
- control.removeListener(SWT.Dispose, controlListener);
- control.removeListener(SWT.DragDetect, controlListener);
- }
- control = null;
- controlListener = null;
- transferAgents = null;
-}
-private byte opToOsOp(int operation){
- byte osOperation = OS.XmDROP_NOOP;
-
- if ((operation & DND.DROP_COPY) == DND.DROP_COPY)
- osOperation |= OS.XmDROP_COPY;
- if ((operation & DND.DROP_MOVE) == DND.DROP_MOVE)
- osOperation |= OS.XmDROP_MOVE;
- if ((operation & DND.DROP_LINK) == DND.DROP_LINK)
- osOperation |= OS.XmDROP_LINK;
-
- return osOperation;
-}
-private int osOpToOp(byte osOperation){
- int operation = DND.DROP_NONE;
-
- if ((osOperation & OS.XmDROP_COPY) == OS.XmDROP_COPY)
- operation |= DND.DROP_COPY;
- if ((osOperation & OS.XmDROP_MOVE) == OS.XmDROP_MOVE)
- operation |= DND.DROP_MOVE;
- if ((osOperation & OS.XmDROP_LINK) == OS.XmDROP_LINK)
- operation |= DND.DROP_LINK;
-
- return operation;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragSetData, listener);
- removeListener (DND.DragEnd, listener);
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index 8f5421a2c9..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,602 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.motif.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public class DropTarget extends Widget {
-
- private Callback dropProc;
- private Callback transferProc;
- private Callback dragProc;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int dropTransferObject;
- private XmDropProcCallback droppedEventData;
-
- private DragUnderEffect effect;
-
- private static final int DRAGOVER_HYSTERESIS = 50;
- private long dragOverStart;
- private Runnable dragOverHeartbeat;
- private DNDEvent dragOverEvent;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- dropProc = new Callback(this, "dropProcCallback", 3);
- if (dropProc == null)
- DND.error(DND.ERROR_CANNOT_INIT_DROP);
-
- dragProc = new Callback(this, "dragProcCallback", 3);
- if (dragProc == null)
- DND.error(DND.ERROR_CANNOT_INIT_DROP);
-
- int[] args = new int[]{
- OS.XmNdropSiteOperations, opToOsOp(style),
- OS.XmNdropSiteActivity, OS.XmDROP_SITE_ACTIVE,
- OS.XmNdropProc, dropProc.getAddress(),
- OS.XmNdragProc, dragProc.getAddress(),
- OS.XmNanimationStyle, OS.XmDRAG_UNDER_NONE,
- OS.XmNdropSiteType, OS.XmDROP_SITE_COMPOSITE,
- };
-
- // the OS may have registered this widget as a drop site on creation.
- // Remove the registered drop site because it has preconfigured values which we do not want.
- //OS.XmDropSiteUnregister(control.handle);
- // Register drop site with our own values
- OS.XmDropSiteRegister(control.handle, args, args.length / 2);
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (!DropTarget.this.isDisposed()){
- DropTarget.this.dispose();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void updateDragOverHover(long delay, DNDEvent event) {
- if (delay == 0) {
- dragOverStart = 0;
- dragOverEvent = null;
- dragOverHeartbeat = null;
- return;
- }
- dragOverStart = System.currentTimeMillis() + delay;
- if (dragOverEvent == null) dragOverEvent = new DNDEvent();
- dragOverEvent.x = event.x;
- dragOverEvent.y = event.y;
- dragOverEvent.dataTypes = event.dataTypes;
- dragOverEvent.operations = event.operations;
- dragOverEvent.dataType = event.dataType;
- dragOverEvent.detail = event.detail;
-}
-private int dragProcCallback(int widget, int client_data, int call_data) {
-
- XmDragProcCallback callbackData = new XmDragProcCallback();
- OS.memmove(callbackData, call_data, XmDragProcCallback.sizeof);
-
- if (callbackData.reason == OS.XmCR_DROP_SITE_ENTER_MESSAGE){
- releaseDropInfo();
-
- // get the export targets
- int ppExportTargets = OS.XtMalloc(4);
- int pNumExportTargets = OS.XtMalloc(4);
- int[] args = new int[]{
- OS.XmNexportTargets, ppExportTargets,
- OS.XmNnumExportTargets, pNumExportTargets
- };
-
- OS.XtGetValues(callbackData.dragContext, args, args.length / 2);
- int[] numExportTargets = new int[1];
- OS.memmove(numExportTargets, pNumExportTargets, 4);
- OS.XtFree(pNumExportTargets);
- int[] pExportTargets = new int[1];
- OS.memmove(pExportTargets, ppExportTargets, 4);
- OS.XtFree(ppExportTargets);
- int[] exportTargets = new int[numExportTargets[0]];
- OS.memmove(exportTargets, pExportTargets[0], 4*numExportTargets[0]);
- //?OS.XtFree(pExportTargets[0]);
-
- for (int i = 0, length = exportTargets.length; i < length; i++){
- for (int j = 0, length2 = transferAgents.length; j < length2; j++){
- TransferData transferData = new TransferData();
- transferData.type = exportTargets[i];
- if (transferAgents[j].isSupportedType(transferData)) {
- TransferData[] newDataTypes = new TransferData[dataTypes.length + 1];
- System.arraycopy(dataTypes, 0, newDataTypes, 0, dataTypes.length);
- newDataTypes[dataTypes.length] = transferData;
- dataTypes = newDataTypes;
- break;
- }
- }
- }
- }
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = callbackData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) callbackData.x, (short) callbackData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- event.operations = osOpToOp(callbackData.operations);
- event.dataType = selectedDataType;
- event.detail = osOpToOp(callbackData.operation);
-
- try {
- switch (callbackData.reason) {
- case OS.XmCR_DROP_SITE_ENTER_MESSAGE :
- if (dataTypes.length > 0) {
- event.dataType = dataTypes[0];
- }
- dragOverHeartbeat = new Runnable() {
- public void run() {
- if (control.isDisposed() || dragOverStart == 0) return;
- long time = System.currentTimeMillis();
- int delay = DRAGOVER_HYSTERESIS;
- if (time >= dragOverStart) {
- DNDEvent event = new DNDEvent();
- event.widget = control;
- event.time = (int)time;
- event.x = dragOverEvent.x;
- event.y = dragOverEvent.y;
- event.dataTypes = dragOverEvent.dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- event.operations = dragOverEvent.operations;
- event.dataType = dragOverEvent.dataType;
- event.detail = dragOverEvent.detail;
- notifyListeners(DND.DragOver, event);
- effect.show(event.feedback, event.x, event.y);
- } else {
- delay = (int)(dragOverStart - time);
- }
- control.getDisplay().timerExec(delay, dragOverHeartbeat);
- }
- };
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
-
- notifyListeners(DND.DragEnter, event);
- effect.show(event.feedback, event.x, event.y);
- dragOverHeartbeat.run();
- break;
-
- case OS.XmCR_DROP_SITE_MOTION_MESSAGE :
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
- notifyListeners(DND.DragOver, event);
- effect.show(event.feedback, event.x, event.y);
- break;
- case OS.XmCR_OPERATION_CHANGED :
- updateDragOverHover(DRAGOVER_HYSTERESIS, event);
- notifyListeners(DND.DragOperationChanged, event);
- effect.show(event.feedback, event.x, event.y);
- break;
- case OS.XmCR_DROP_SITE_LEAVE_MESSAGE :
- event.detail = DND.DROP_NONE;
- updateDragOverHover(0, null);
- notifyListeners(DND.DragLeave, event);
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- return 0;
- }
- } catch (Throwable err) {
- callbackData.dropSiteStatus = OS.XmDROP_SITE_INVALID;
- callbackData.operation = opToOsOp(DND.DROP_NONE);
- OS.memmove(call_data, callbackData, XmDragProcCallback.sizeof);
- return 0;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)) {
- selectedDataType = event.dataType;
- break;
- }
- }
- int lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((event.detail & osOpToOp(callbackData.operations)) == event.detail)) {
- lastOperation = event.detail;
- }
-
- callbackData.dropSiteStatus = OS.XmDROP_SITE_VALID;
- callbackData.operation = opToOsOp(lastOperation);
- OS.memmove(call_data, callbackData, XmDragProcCallback.sizeof);
-
- return 0;
-}
-private int dropProcCallback(int widget, int client_data, int call_data) {
- updateDragOverHover(0, null);
- effect.show(DND.FEEDBACK_NONE, 0, 0);
-
- droppedEventData = new XmDropProcCallback();
- OS.memmove(droppedEventData, call_data, XmDropProcCallback.sizeof);
-
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = droppedEventData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) droppedEventData.x, (short) droppedEventData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.operations = osOpToOp(droppedEventData.operations);
- event.dataType = selectedDataType;
- event.detail = osOpToOp(droppedEventData.operation);
-
- try {
- notifyListeners(DND.DropAccept,event);
- } catch (Throwable err) {
- event.detail = DND.DROP_NONE;
- event.dataType = null;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)) {
- selectedDataType = event.dataType;
- break;
- }
- }
- int lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((event.detail & osOpToOp(droppedEventData.operations)) == event.detail)) {
- lastOperation = event.detail;
- }
-
- if (lastOperation == DND.DROP_NONE) {
- // this was not a successful drop
- int[] args = new int[] {OS.XmNtransferStatus, OS.XmTRANSFER_FAILURE,
- OS.XmNnumDropTransfers, 0};
- dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);
- return 0;
- }
-
- // ask drag source for dropped data
- int[] transferEntries = new int[2];
- transferEntries[0] = 0;
- transferEntries[1] = selectedDataType.type;
-
- int pTransferEntries = OS.XtMalloc(transferEntries.length * 4);
- OS.memmove(pTransferEntries, transferEntries, transferEntries.length * 4);
- if (transferProc == null)
- transferProc = new Callback(this, "transferProcCallback", 7);
-
- if (transferProc != null){
- int[] args = new int[] {OS.XmNdropTransfers, pTransferEntries,
- OS.XmNnumDropTransfers, transferEntries.length / 2,
- OS.XmNtransferProc, transferProc.getAddress()};
-
- dropTransferObject = OS.XmDropTransferStart(droppedEventData.dragContext, args, args.length / 2);
- OS.XtFree(pTransferEntries);
- }
-
- return 0;
-}
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-private void onDispose() {
-
- if (dropProc != null)
- dropProc.dispose();
- dropProc = null;
-
- if (transferProc != null)
- transferProc.dispose();
- transferProc = null;
-
- if (dragProc != null)
- dragProc.dispose();
- dragProc = null;
- //if (control != null && !control.isDisposed()){
- // OS.XmDropSiteUnregister(control.handle);
- //}
- if (controlListener != null) {
- control.removeListener(SWT.Dispose, controlListener);
- }
- controlListener = null;
- control = null;
- transferAgents = null;
-}
-private byte opToOsOp(int operation){
- byte osOperation = OS.XmDROP_NOOP;
-
- if ((operation & DND.DROP_COPY) == DND.DROP_COPY)
- osOperation |= OS.XmDROP_COPY;
- if ((operation & DND.DROP_MOVE) == DND.DROP_MOVE)
- osOperation |= OS.XmDROP_MOVE;
- if ((operation & DND.DROP_LINK) == DND.DROP_LINK)
- osOperation |= OS.XmDROP_LINK;
-
- return osOperation;
-}
-private int osOpToOp(byte osOperation){
- int operation = DND.DROP_NONE;
-
- if ((osOperation & OS.XmDROP_COPY) == OS.XmDROP_COPY)
- operation |= DND.DROP_COPY;
- if ((osOperation & OS.XmDROP_MOVE) == OS.XmDROP_MOVE)
- operation |= DND.DROP_MOVE;
- if ((osOperation & OS.XmDROP_LINK) == OS.XmDROP_LINK)
- operation |= DND.DROP_LINK;
-
- return operation;
-}
-private void releaseDropInfo(){
- selectedDataType = null;
- dataTypes = new TransferData[0];
- droppedEventData = null;
- dropTransferObject = 0;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-
- // register data types
- TransferData[] transferData = new TransferData[0];
- for (int i = 0, length = transferAgents.length; i < length; i++){
- TransferData[] data = transferAgents[i].getSupportedTypes();
- TransferData[] newTransferData = new TransferData[transferData.length + data.length];
- System.arraycopy(transferData, 0, newTransferData, 0, transferData.length);
- System.arraycopy(data, 0, newTransferData, transferData.length, data.length);
- transferData = newTransferData;
- }
-
- int[] atoms = new int[transferData.length];
- for (int i = 0, length = transferData.length; i < length; i++){
- atoms[i] = transferData[i].type;
- }
-
- // Copy import targets to global memory
- int pImportTargets = OS.XtMalloc(atoms.length * 4);
- OS.memmove(pImportTargets, atoms, atoms.length * 4);
-
- int[] args = new int[]{
- OS.XmNimportTargets, pImportTargets,
- OS.XmNnumImportTargets, atoms.length
- };
-
- OS.XmDropSiteUpdate(control.handle, args, args.length / 2);
-
- OS.XtFree(pImportTargets);
-
-}
-private int transferProcCallback(int widget, int client_data, int pSelection, int pType, int pValue, int pLength, int pFormat) {
-
- int[] type = new int[1];
- OS.memmove(type, pType, 4);
-
- // get dropped data object
- Transfer transferAgent = null;
- TransferData transferData = new TransferData();
- transferData.type = type[0];
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferAgent = transferAgents[i];
- break;
- }
- }
- if (transferAgent != null) {
- transferData.pValue = pValue;
- int[] length = new int[1];
- OS.memmove(length, pLength, 4);
- transferData.length = length[0];
- int[] format = new int[1];
- OS.memmove(format, pFormat, 4);
- transferData.format = format[0];
- Object data = transferAgent.nativeToJava(transferData);
-
- OS.XtFree(transferData.pValue); //?? Should we be freeing this, and what about the other memory?
-
- // notify listeners of drop
- DNDEvent event = new DNDEvent();
- event.widget = this.control;
- event.time = droppedEventData.timeStamp;
- short [] root_x = new short [1];
- short [] root_y = new short [1];
- OS.XtTranslateCoords (this.control.handle, (short) droppedEventData.x, (short) droppedEventData.y, root_x, root_y);
- event.x = root_x[0];
- event.y = root_y[0];
- event.dataTypes = dataTypes;
- event.operations = osOpToOp(droppedEventData.operations);
- event.dataType = transferData;
- event.detail = osOpToOp(droppedEventData.operation);
- event.data = data;
-
- try {
- notifyListeners(DND.Drop,event);
- } catch (Throwable err) {
- event.detail = DND.DROP_NONE;
- }
-
- if ((event.detail & DND.DROP_MOVE) == DND.DROP_MOVE) {
- OS.XmDropTransferAdd(dropTransferObject, new int[]{0, Transfer.registerType("DELETE\0")}, 1);
- }
- }
-
- return 0;
-}
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index 0bda4b53f6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
- private static final String TYPENAME = "text/uri-list\0";
- private static final int TYPEID = registerType(TYPENAME);
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-
- if (object == null || !(object instanceof String[])) return;
-
- // build a byte array from data
- String[] files = (String[])object;
-
- // create a string separated by "new lines" to represent list of files
- String nativeFormat = "file:";
- for (int i = 0, length = files.length; i < length; i++){
- nativeFormat += files[i]+"\r";
- }
- nativeFormat += "\0";
- // pass byte array on to super to convert to native
- super.javaToNative(nativeFormat.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
-
- byte[] data = (byte[])super.nativeToJava(transferData);
- if (data == null) return null;
- String string = new String(data);
- // parse data and convert string to array of files
- int start = string.indexOf("file:");
- if (start == -1) return null;
- start += 5;
- String[] fileNames = new String[0];
- while (start < string.length()) {
- int end = string.indexOf("\r", start);
- if (end == -1) end = string.length() - 1;
-
- String fileName = string.substring(start, end);
- String[] newFileNames = new String[fileNames.length + 1];
- System.arraycopy(fileNames, 0, newFileNames, 0, fileNames.length);
- newFileNames[fileNames.length] = fileName;
- fileNames = newFileNames;
-
- start = string.indexOf("file:", end);
- if (start == -1) break;
- start += 5;
- }
- return fileNames;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index f2b015d4b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME1 = "text/rtf\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "TEXT/RTF\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "application/rtf\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- String text = (String)object;
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- return new String(buffer);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index 7b9e962ca3..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
- private TableItem dropSelection;
- private TableItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.deselectAll();
- }
- scrollHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
- currentEffect = effect;
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(item);
- return;
- }
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) setDropSelection(null);
-}
-private void setDropSelection (TableItem item) {
- if (item == dropSelection) return;
- if (dropSelection != null) table.deselectAll();
- dropSelection = item;
- if (dropSelection != null) table.setSelection(new TableItem[]{dropSelection});
-}
-private void scrollHover (int effect, TableItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TableItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- Rectangle area = table.getClientArea();
- TableItem showItem = null;
- int itemIndex = table.indexOf(item);
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = table.getItem(Math.max(0, itemIndex - 1));
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = table.getItem(Math.min(table.getItemCount() - 1, itemIndex + 1));
- }
- if (showItem != null) {
- table.showItem(showItem);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index 93fb0cf71e..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME1 = "STRING\0";
- private static final int TYPEID1 = registerType(TYPENAME1);
- private static final String TYPENAME2 = "text/plain\0";
- private static final int TYPEID2 = registerType(TYPENAME2);
- private static final String TYPENAME3 = "text/text\0";
- private static final int TYPEID3 = registerType(TYPENAME3);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- String text = (String)object;
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- return new String(buffer);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME1, TYPENAME2, TYPENAME3};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID1, TYPEID2, TYPEID3};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index adfd307815..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.motif.OS;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
-
- int xDisplay = Display.getDefault().xDisplay; // using default because we don't have a particular widget
- /* Use the character encoding for the default locale */
- byte[] bName = Converter.wcsToMbcs (null, formatName, false);
- int atom = OS.XmInternAtom (xDisplay, bName, false);
- return atom;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index 19562957a4..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- /* attributes specific to set/get */
- int length;
- int format;
- int pValue;
-
- int result;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index 4dc65a9ae6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.SWT;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
- private TreeItem dropSelection = null;
- private TreeItem insertMark = null;
- private boolean insertBefore = false;
-
- private TreeItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
- private TreeItem expandItem;
- private long expandBeginTime;
- private static final int EXPAND_HYSTERESIS = 1000; // milli seconds
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- effect = checkEffect(effect);
- TreeItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.deselectAll();
- }
- scrollHover(effect, item, x, y);
- expandHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
- currentEffect = effect;
-}
-private int checkEffect(int effect) {
- // Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
- int mask = DND.FEEDBACK_INSERT_AFTER | DND.FEEDBACK_INSERT_BEFORE | DND.FEEDBACK_SELECT;
- int bits = effect & mask;
- if (bits == DND.FEEDBACK_INSERT_AFTER || bits == DND.FEEDBACK_INSERT_BEFORE || bits == DND.FEEDBACK_SELECT) return effect;
- return (effect & ~mask);
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- if (!area.contains(coordinates)) return null;
-
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree.
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, coordinates.y);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- // Check if we are just below the last item of the tree
- coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- if (coordinates.y > area.y + area.height - tree.getItemHeight()) {;
- int y1 = area.y + area.height - tree.getItemHeight();
- coordinates = new Point(coordinates.x, y1);
-
- item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree just above the bottom..
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y1);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- setDropSelection(item);
- return;
- }
- if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (effect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- setInsertMark(item, (effect & DND.FEEDBACK_INSERT_BEFORE) != 0);
- return;
- }
-
- setInsertMark(null, false);
- setDropSelection(null);
-}
-private void setDropSelection (TreeItem item) {
- if (item == dropSelection) return;
- if (dropSelection != null) tree.deselectAll();
- dropSelection = item;
- if (dropSelection != null) tree.setSelection(new TreeItem[]{dropSelection});
-}
-private void setInsertMark(TreeItem item, boolean before) {
- if (item == insertMark && before == insertBefore) return;
- insertMark = item;
- insertBefore = before;
- tree.setInsertMark(item, before);
-}
-private void scrollHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TreeItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- TreeItem showItem = null;
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = getPreviousVisibleItem(item);
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = getNextVisibleItem(item, true);
- }
- if (showItem != null) {
- tree.showItem(showItem);
- }
-}
-private void expandHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_EXPAND) == 0) {
- expandBeginTime = 0;
- expandItem = null;
- return;
- }
- if (expandItem == item && expandBeginTime != 0) {
- if (System.currentTimeMillis() >= expandBeginTime) {
- expand(item, x, y);
- expandBeginTime = 0;
- expandItem = null;
- }
- return;
- }
- expandBeginTime = System.currentTimeMillis() + EXPAND_HYSTERESIS;
- expandItem = item;
-}
-private void expand(TreeItem item, int x, int y) {
- if (item == null || item.getExpanded()) return;
- Event event = new Event();
- event.x = x;
- event.y = y;
- event.item = item;
- event.time = (int) System.currentTimeMillis();
- tree.notifyListeners(SWT.Expand, event);
- if (item.isDisposed()) return;
- item.setExpanded(true);
-}
-private TreeItem getNextVisibleItem(TreeItem item, boolean includeChildren) {
- // look down
- // neccesary on the first pass only
- if (includeChildren && item.getItemCount() > 0 && item.getExpanded()) {
- return item.getItems()[0];
- }
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = 0; i < peers.length - 1; i++) {
- if (peers[i] == item) return peers[i + 1];
- }
- // look up
- if (parent != null) return getNextVisibleItem(parent, false);
- return null;
-}
-private TreeItem getPreviousVisibleItem(TreeItem item) {
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = peers.length - 1; i > 0; i--) {
- if (peers[i] == item) {
- TreeItem peer = peers[i-1];
- if (!peer.getExpanded() || peer.getItemCount() == 0) return peer;
- TreeItem[] peerItems = peer.getItems();
- return peerItems[peerItems.length - 1];
- }
- }
- // look up
- return parent;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index 3ab0c9971d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.photon.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- }
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- if (transferData.type == types[i]) return true;
- }
- return false;
-}
-protected void javaToNative (Object object, TransferData transferData){
- if ((object == null) || !(object instanceof byte[]) || !(isSupportedType(transferData))) {
- transferData.result = 0;
- return;
- }
- byte[] buffer = (byte[])object;
- transferData.pData = OS.malloc(buffer.length);
- OS.memmove(transferData.pData, buffer, buffer.length);
- transferData.length = buffer.length;
- transferData.result = 1;
-}
-protected Object nativeToJava(TransferData transferData){
-
- if (transferData.pData == 0 || !(isSupportedType(transferData))) return null;
-
- int size = transferData.length;
- if (size == 0) return null;
- byte[] buffer = new byte[size];
- OS.memmove(buffer, transferData.pData, size);
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 266f5107ab..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- private Display display;
- private final int MAX_RETRIES = 10;
-
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
- this.display = display;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- display = null;
-}
-public Object getContents(Transfer transfer) {
- if (display.isDisposed() ) return null;
-
- Object result = null;
-
- int ig = OS.PhInputGroup(0);
- int cbdata = OS.PhClipboardPasteStart((short)ig);
- if (cbdata == 0) return result;
- try {
- String[] types = transfer.getTypeNames();
- int[] ids = transfer.getTypeIds();
- for (int i = 0; i < types.length; i++) {
- byte[] type = Converter.wcsToMbcs(null, types[i], true);
- int pClipHeader = OS.PhClipboardPasteType(cbdata, type);
- if (pClipHeader != 0) {
- PhClipHeader clipHeader = new PhClipHeader();
- OS.memmove(clipHeader, pClipHeader, PhClipHeader.sizeof);
- TransferData data = new TransferData();
- data.pData = clipHeader.data;
- data.length = clipHeader.length;
- data.type = ids[i];
- result = transfer.nativeToJava(data);
- break;
- }
- }
- } finally {
- OS.PhClipboardPasteFinish(cbdata);
- }
-
- return result;
-}
-public void setContents(Object[] data, Transfer[] transferAgents){
- if (display.isDisposed() ) return;
-
- if (data == null) {
- int ig = OS.PhInputGroup(0);
- if (OS.PhClipboardCopy((short)ig, 0, null) != 0) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- }
- return;
- }
- if (transferAgents == null || data.length != transferAgents.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- byte[] clips = new byte[0];
- int count = 0;
- for (int i = 0; i < transferAgents.length; i++) {
- String[] names = transferAgents[i].getTypeNames();
- int[] ids = transferAgents[i].getTypeIds();
- for (int j = 0; j < names.length; j++) {
- TransferData transferData = new TransferData();
- transferData.type = ids[j];
- transferAgents[i].javaToNative(data[i], transferData);
- PhClipHeader clip = new PhClipHeader();
- clip.data = transferData.pData;
- clip.length = (short)transferData.length;
- byte[] temp = Converter.wcsToMbcs(null, names[j], false);
- byte[] type = new byte[8];
- System.arraycopy(temp, 0, type, 0, Math.min(type.length, temp.length));
- clip.type_0 = type[0];
- clip.type_1 = type[1];
- clip.type_2 = type[2];
- clip.type_3 = type[3];
- clip.type_4 = type[4];
- clip.type_5 = type[5];
- clip.type_6 = type[6];
- clip.type_7 = type[7];
- byte[] buffer = new byte[PhClipHeader.sizeof];
- OS.memmove(buffer, clip, PhClipHeader.sizeof);
- byte[] newClips = new byte[clips.length + buffer.length];
- System.arraycopy(clips, 0, newClips, 0, clips.length);
- System.arraycopy(buffer, 0, newClips, clips.length, buffer.length);
- clips = newClips;
- count++;
- }
- }
-
- if (count > 0){
- int ig = OS.PhInputGroup(0);
- if (OS.PhClipboardCopy((short)ig, count, clips) != 0) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD);
- }
- }
-}
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- String[] types = new String[0];
- int ig = OS.PhInputGroup(0);
- int cbdata = OS.PhClipboardPasteStart((short)ig);
- if (cbdata == 0) return types;
- try {
- int pClipHeader = 0;
- int n = 0;
- while ((pClipHeader = OS.PhClipboardPasteTypeN(cbdata, n++)) != 0) {
- PhClipHeader clipHeader = new PhClipHeader();
- OS.memmove(clipHeader, pClipHeader, PhClipHeader.sizeof);
- byte[] buffer = new byte[8];
- buffer[0] = clipHeader.type_0;
- buffer[1] = clipHeader.type_1;
- buffer[2] = clipHeader.type_2;
- buffer[3] = clipHeader.type_3;
- buffer[4] = clipHeader.type_4;
- buffer[5] = clipHeader.type_5;
- buffer[6] = clipHeader.type_6;
- buffer[7] = clipHeader.type_7;
- char [] unicode = Converter.mbcsToWcs (null, buffer);
-
- String[] newTypes = new String[types.length + 1];
- System.arraycopy(types, 0, newTypes, 0, types.length);
- newTypes[types.length] = new String (unicode).trim();
- types = newTypes;
- }
- } finally {
- OS.PhClipboardPasteFinish(cbdata);
- }
- return types;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 9c3fedd6a6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-public class DragSource extends Widget {
-
- private Callback convertProc;
- private Callback dragDropFinish;
- private Callback dropFinish;
-
- // info for registering as a drag source
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- private boolean myDrag;
-
- int dragContext;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose) {
- if (!DragSource.this.isDisposed()){
- DragSource.this.dispose();
- }
- }
- if (event.type == SWT.DragDetect){
-// DragSource.this.drag();
- }
-
- }
- };
- this.control.addListener (SWT.Dispose, controlListener);
- this.control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
-// onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragSetData, typedListener);
- addListener (DND.DragEnd, typedListener);
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-
-
-
-
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-/**
-* Gets the Display.
-*/
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-
-
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragSetData, listener);
- removeListener (DND.DragEnd, listener);
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index 1abeb8104d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.*;
-import org.eclipse.swt.internal.photon.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-public class DropTarget extends Widget {
-
- private Callback dropProc;
- private Callback transferProc;
- private Callback dragProc;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
- private Transfer[] transferAgents = new Transfer[0];
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int dropTransferObject;
-
- private DragUnderEffect effect;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (!DropTarget.this.isDisposed()){
- DropTarget.this.dispose();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- //onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-
-
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-
-
-
-
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
-}
-
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index 9ba4ffe40b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
- private static final String TYPENAME = "files";
- private static final int TYPEID = registerType(TYPENAME);
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
- DND.error(org.eclipse.swt.SWT.ERROR_NOT_IMPLEMENTED);
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
- DND.error(org.eclipse.swt.SWT.ERROR_NOT_IMPLEMENTED);
- return null;
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index 0a7123f4a5..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static RTFTransfer _instance = new RTFTransfer();
- private static final String TYPENAME = "RTF";
- private static final int TYPEID = registerType(TYPENAME);
-
-private RTFTransfer() {
-}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
- byte [] buffer = Converter.wcsToMbcs (null, (String)object, false);
- super.javaToNative(buffer, transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- /// get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index d9e566bb5d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem currentItem;
- private TableItem[] selection = new TableItem[0];
- private int currentEffect = DND.FEEDBACK_NONE;
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.setSelection(new TableItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if (currentItem != item) {
- if (item == null) {
- table.setSelection(new TableItem[0]);
- } else {
- table.setSelection(new TableItem[] {item});
- }
- currentItem = item;
- }
- currentEffect = effect;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index c6e037cf14..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.internal.Converter;
-import org.eclipse.swt.internal.photon.OS;
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
- private static final String TYPENAME = "TEXT";
- private static final int TYPEID = registerType(TYPENAME);
-
-private TextTransfer() {
-}
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
- byte [] buffer = Converter.wcsToMbcs (null, (String)object, false);
- super.javaToNative(buffer, transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- char [] unicode = Converter.mbcsToWcs (null, buffer);
- return new String (unicode);
-}
-protected String[] getTypeNames(){
- return new String[]{TYPENAME};
-}
-protected int[] getTypeIds(){
- return new int[]{TYPEID};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index 7984436caf..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-abstract protected String[] getTypeNames();
-abstract protected int[] getTypeIds();
-abstract protected void javaToNative (Object object, TransferData transferData);
-abstract protected Object nativeToJava(TransferData transferData);
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- if (formatName == "TEXT") return 10;
- if (formatName == "files") return 11;
- if (formatName == "RTF") return 12;
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index b287069a6f..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- // attributes specific to set/get
- int pData;
- int length;
- int result;
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index d37961bda1..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private TreeItem currentItem = null;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- TreeItem item = null;
- if (effect != DND.FEEDBACK_NONE) item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect != effect && currentEffect == DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.setSelection(new TreeItem[0]);
- }
- boolean restoreSelection = currentEffect != effect && effect == DND.FEEDBACK_NONE;
- setDragUnderEffect(effect, item);
- if (restoreSelection) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
-}
-private TreeItem findItem(int x , int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = tree.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = tree.toControl(coordinates);
- item = tree.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- switch (effect) {
- case DND.FEEDBACK_SELECT:
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setDropSelection(item);
- currentEffect = DND.FEEDBACK_SELECT;
- currentItem = item;
- }
- break;
- case DND.FEEDBACK_INSERT_AFTER:
- case DND.FEEDBACK_INSERT_BEFORE:
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- }
- if (currentEffect != effect || currentItem != item) {
- setInsertMark(item, effect == DND.FEEDBACK_INSERT_AFTER);
- currentEffect = effect;
- currentItem = item;
- }
- break;
- default :
- if (currentEffect == DND.FEEDBACK_INSERT_AFTER ||
- currentEffect == DND.FEEDBACK_INSERT_BEFORE) {
- setInsertMark(null, false);
- }
- if (currentEffect == DND.FEEDBACK_SELECT) {
- setDropSelection(null);
- }
- currentEffect = DND.FEEDBACK_NONE;
- currentItem = null;
- break;
- }
-}
-private void setDropSelection (TreeItem item) {
- if (item == null) {
- tree.setSelection(new TreeItem[0]);
- } else {
- tree.setSelection(new TreeItem[]{item});
- }
-}
-private void setInsertMark (TreeItem item, boolean after) {
- // not currently implemented
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
deleted file mode 100755
index 86e486532d..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- * The class <code>ByteArrayTransfer</code> provides a platform specific mechanism for transforming
- * a Java array of bytes into a format that can be passed around in a Drag and Drop operation and vice
- * versa.
- *
- * <p>This abstract class can be subclassed to provided utilities for transforming Java data types
- * into the byte array based platform specific drag and drop data types. See TextTransfer and
- * FileTransfer for examples. If the data you are transferring <b>does not</b> map to a byte array,
- * you should sub-class Transfer directly and do your own mapping to the platform data types.</p>
- */
-public abstract class ByteArrayTransfer extends Transfer {
-public TransferData[] getSupportedTypes(){
-
- int[] types = getTypeIds();
- TransferData[] data = new TransferData[types.length];
- for (int i = 0; i < types.length; i++) {
- data[i] = new TransferData();
- data[i].type = types[i];
- data[i].formatetc = new FORMATETC();
- data[i].formatetc.cfFormat = types[i];
- data[i].formatetc.dwAspect = COM.DVASPECT_CONTENT;
- data[i].formatetc.lindex = -1;
- data[i].formatetc.tymed = COM.TYMED_HGLOBAL;
- }
-
- return data;
-}
-public boolean isSupportedType(TransferData transferData){
-
- int[] types = getTypeIds();
- for (int i = 0; i < types.length; i++) {
- FORMATETC format = transferData.formatetc;
- if (format.cfFormat == types[i] &&
- (format.dwAspect & COM.DVASPECT_CONTENT) == COM.DVASPECT_CONTENT &&
- (format.tymed & COM.TYMED_HGLOBAL) == COM.TYMED_HGLOBAL )
- return true;
- }
- return false;
-}
-/**
- * Converts a Java byte array to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java byte array containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-protected void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof byte[])) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- byte[] data = (byte[])object;
-
- if (isSupportedType(transferData)) {
- // Allocate the memory because the caller (DropTarget) has not handed it in
- // The caller of this method must release the data when it is done with it.
- int size = data.length;
- int newPtr = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, size);
- OS.MoveMemory(newPtr, data, size);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-}
-/**
- * Converts a platform specific representation of a byte array to a Java byte array.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java byte array containing the transferred data if the conversion was successful;
- * otherwise null
- */
-protected Object nativeToJava(TransferData transferData){
-
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- IDataObject data = new IDataObject(transferData.pIDataObject);
- data.AddRef();
-
- FORMATETC formatetc = transferData.formatetc;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.result = data.GetData(formatetc, stgmedium);
- data.Release();
-
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- int size = OS.GlobalSize(stgmedium.unionField);
- byte[] buffer = new byte[size];
- int ptr = OS.GlobalLock(stgmedium.unionField);
- OS.MoveMemory(buffer, ptr, size);
- OS.GlobalUnlock(ptr);
- OS.GlobalFree(stgmedium.unionField);
-
- return buffer;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java
deleted file mode 100755
index 2eb5d8296b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Clipboard.java
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.internal.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- */
-public class Clipboard {
-
- // ole interfaces
- private COMObject iUnknown;
- private COMObject iDataObject;
- private int refCount;
-
- private final int MAX_RETRIES = 10;
- private Transfer[] transferAgents = new Transfer[0];
- private Object[] data = new Object[0];
-
-public Clipboard(Display display) {
- checkSubclass ();
- if (display == null) {
- display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- }
- if (display.getThread() != Thread.currentThread()) {
- SWT.error(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
-
- createCOMInterfaces();
- this.AddRef();
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = Clipboard.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-public void dispose () {
- this.Release();
-}
-public Object getContents(Transfer transfer) {
- int[] ppv = new int[1];
- int retrys = 0;
- while ((COM.OleGetClipboard(ppv) != COM.S_OK) && retrys < MAX_RETRIES) {
- retrys++;
- }
- if (retrys == MAX_RETRIES) return null;
-
- IDataObject dataObject = new IDataObject(ppv[0]);
-
- TransferData[] allowed = transfer.getSupportedTypes();
- TransferData match = null;
- for (int i = 0; i < allowed.length; i++) {
- if (dataObject.QueryGetData(allowed[i].formatetc) == COM.S_OK) {
- match = allowed[i];
- break;
- }
- }
- if (match == null) return null;
-
- match.pIDataObject = ppv[0];
- return transfer.nativeToJava(match);
-}
-public void setContents(Object[] data, Transfer[] dataTypes){
-
- boolean current = (COM.OleIsCurrentClipboard(this.iDataObject.getAddress()) == COM.S_OK);
-
- if (data == null || dataTypes == null || data.length != dataTypes.length) {
- DND.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- this.data = data;
- this.transferAgents = dataTypes;
-
- int retries = 0;
- int result = 0;
- while ((result = COM.OleSetClipboard(this.iDataObject.getAddress())) != COM.S_OK && retries < MAX_RETRIES){
- retries++;
- }
- if (retries == MAX_RETRIES) {
- DND.error(DND.ERROR_CANNOT_SET_CLIPBOARD, result);
- }
-
- if (COM.OleIsCurrentClipboard(this.iDataObject.getAddress()) != COM.S_OK) return;
-
- retries = 0;
- while ((COM.OleFlushClipboard() != COM.S_OK) && (retries < MAX_RETRIES)) {
- retries++;
- }
-
- this.data = new Object[0];
- this.transferAgents = new Transfer[0];
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
- iDataObject = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 2, 3, 2, 4, 1, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetData(args[0], args[1]);}
- // method4 GetDataHere - not implemented
- public int method5(int[] args) {return QueryGetData(args[0]);}
- // method6 GetCanonicalFormatEtc - not implemented
- // method7 SetData - not implemented
- public int method8(int[] args) {return EnumFormatEtc(args[0], args[1]);}
- // method9 DAdvise - not implemented
- // method10 DUnadvise - not implemented
- // method11 EnumDAdvise - not implemented
- };
-}
-private void disposeCOMInterfaces() {
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDataObject != null)
- iDataObject.dispose();
- iDataObject = null;
-}
-private int EnumFormatEtc(int dwDirection, int ppenumFormatetc) {
- // only allow getting of data - SetData is not currently supported
- if (dwDirection == COM.DATADIR_SET) return COM.E_NOTIMPL;
-
- // what types have been registered?
- TransferData[] allowedDataTypes = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] formats = transferAgents[i].getSupportedTypes();
- TransferData[] newAllowedDataTypes = new TransferData[allowedDataTypes.length + formats.length];
- System.arraycopy(allowedDataTypes, 0, newAllowedDataTypes, 0, allowedDataTypes.length);
- System.arraycopy(formats, 0, newAllowedDataTypes, allowedDataTypes.length, formats.length);
- allowedDataTypes = newAllowedDataTypes;
- }
-
- OleEnumFORMATETC enumFORMATETC = new OleEnumFORMATETC();
- enumFORMATETC.AddRef();
-
- FORMATETC[] formats = new FORMATETC[allowedDataTypes.length];
- for (int i = 0; i < formats.length; i++){
- formats[i] = allowedDataTypes[i].formatetc;
- }
- enumFORMATETC.setFormats(formats);
-
- COM.MoveMemory(ppenumFormatetc, new int[] {enumFORMATETC.getAddress()}, 4);
- return COM.S_OK;
-}
-private int GetData(int pFormatetc, int pmedium) {
- /* Called by a data consumer to obtain data from a source data object.
- The GetData method renders the data described in the specified FORMATETC
- structure and transfers it through the specified STGMEDIUM structure.
- The caller then assumes responsibility for releasing the STGMEDIUM structure.
- */
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- if (QueryGetData(pFormatetc) != COM.S_OK) return COM.DV_E_FORMATETC;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.E_FAIL;
-
- // get matching transfer agent to perform conversion
- int transferIndex = -1;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- transferIndex = i;
- break;
- }
- }
- if (transferIndex == -1) return COM.DV_E_FORMATETC;
-
- transferAgents[transferIndex].javaToNative(data[transferIndex], transferData);
- COM.MoveMemory(pmedium, transferData.stgmedium, STGMEDIUM.sizeof);
- return transferData.result;
-}
-private int QueryGetData(int pFormatetc) {
-
- if (transferAgents == null) return COM.E_FAIL;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- // is this type supported by the transfer agent?
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData))
- return COM.S_OK;
- }
-
- return COM.DV_E_FORMATETC;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDataObject) ) {
- COM.MoveMemory(ppvObject, new int[] {iDataObject.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-
-/*
- * Note: getAvailableTypeNames is a tool for writing a Transfer sub-class only. It should
- * NOT be used within an application because it provides platform specfic
- * information.
- */
-public String[] getAvailableTypeNames() {
- int[] ppv = new int[1];
- int retrys = 0;
- while ((COM.OleGetClipboard(ppv) != COM.S_OK) && retrys < MAX_RETRIES) {
- retrys++;
- }
- if (retrys == MAX_RETRIES) return null;
-
- IDataObject dataObject = new IDataObject(ppv[0]);
-
- int[] ppFormatetc = new int[1];
- int rc = dataObject.EnumFormatEtc(COM.DATADIR_GET, ppFormatetc);
- dataObject.Release();
- if (rc != COM.S_OK)
- DND.error(SWT.ERROR_UNSPECIFIED);
-
- IEnumFORMATETC enum = new IEnumFORMATETC(ppFormatetc[0]);
-
- // Loop over enumerator and save any types that match what we are looking for
- int rgelt = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, FORMATETC.sizeof);
- int[] pceltFetched = new int[1];
- enum.Reset();
- String[] types = new String[0];
- while (enum.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {
- FORMATETC formatetc = new FORMATETC();
- COM.MoveMemory(formatetc, rgelt, FORMATETC.sizeof);
- int maxSize = 128;
- TCHAR buffer = new TCHAR(0, maxSize);
- int size = COM.GetClipboardFormatName(formatetc.cfFormat, buffer, maxSize);
- String type = null;
- if (size != 0) {
- type = buffer.toString(0, size);
- } else {
- switch (formatetc.cfFormat) {
- case COM.CF_HDROP:
- type = "CF_HDROP";
- break;
- case COM.CF_TEXT:
- type = "CF_TEXT";
- break;
- case COM.CF_BITMAP:
- type = "CF_BITMAP";
- break;
- case COM.CF_METAFILEPICT:
- type = "CF_METAFILEPICT";
- break;
- case COM.CF_SYLK:
- type = "CF_SYLK";
- break;
- case COM.CF_DIF:
- type = "CF_DIF";
- break;
- case COM.CF_TIFF:
- type = "CF_TIFF";
- break;
- case COM.CF_OEMTEXT:
- type = "CF_OEMTEXT";
- break;
- case COM.CF_DIB:
- type = "CF_DIB";
- break;
- case COM.CF_PALETTE:
- type = "CF_PALETTE";
- break;
- case COM.CF_PENDATA:
- type = "CF_PENDATA";
- break;
- case COM.CF_RIFF:
- type = "CF_RIFF";
- break;
- case COM.CF_WAVE:
- type = "CF_WAVE";
- break;
- case COM.CF_UNICODETEXT:
- type = "CF_UNICODETEXT";
- break;
- case COM.CF_ENHMETAFILE:
- type = "CF_ENHMETAFILE";
- break;
- case COM.CF_LOCALE:
- type = "CF_LOCALE";
- break;
- case COM.CF_MAX:
- type = "CF_MAX";
- break;
- default:
- continue;
- }
- }
-
- String[] newTypes = new String[types.length + 1];
- System.arraycopy(types, 0, newTypes, 0, types.length);
- newTypes[types.length] = type;
- types = newTypes;
- }
- OS.GlobalFree(rgelt);
- enum.Release();
-
- return types;
-
-}
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
deleted file mode 100755
index 65c21271bd..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DragSource.java
+++ /dev/null
@@ -1,482 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- *
- * Class <code>DragSource</code> defines the source object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class defines the following items:<ul>
- * <li>the <code>Control</code> that the user clicks on to intiate a drag;
- * <li>the data that will be transferred on a successful drop;
- * <li>and the modes (move, copy, link) of transfer that are allowed.
- * </ul></p>
- *
- * <p>You may have several DragSources in an application but you can only have one DragSource
- * per Control. Data dragged from this DragSource can be dropped on a site within this application
- * but it can also be dropped on another application such as an external Text editor.</p>
- *
- * <p>The application supplies the content of the data being transferred by implementing the interface
- * <code>DragSourceListener</code> which uses the class <code>DragSourceEvent</code>.
- * The application is required to take the appropriate action to remove the data from the drag source
- * when a successful move operation occurs.</p>
- *
- * <code><pre>
- * // Enable a label as a Drag Source
- * Label label = new Label(shell, SWT.NONE);
- * // This example will allow text to be dragged
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * // This example will allow the text to be copied or moved to the drop target
- * int operations = DND.DROP_MOVE | DND.DROP_COPY;
- *
- * DragSource source = new DragSource (label, operations);
- * source.setTransfer(types);
- * source.addDragListener (new DragSourceListener() {
- * public void dragStart(DragSourceEvent e) {
- * // Only start the drag if there is actually text in the
- * // label - this text will be what is dropped on the target.
- * if (label.getText().length() == 0) {
- * event.doit = false;
- * }
- * };
- * public void dragSetData (DragSourceEvent event) {
- * // A drop has been performed, so provide the data of the
- * // requested type.
- * // (Checking the type of the requested data is only
- * // necessary if the drag source supports more than
- * // one data type but is shown here as an example).
- * if (TextTransfer.getInstance().isSupportedType(event.dataType)){
- * event.data = label.getText();
- * }
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // A Move operation has been performed so remove the data
- * // from the source
- * if (event.detail == DND.DROP_MOVE)
- * label.setText("");
- * }
- * });
- * </pre></code>
- *
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnd, DND.DragSetData
- * </dl>
- */
-
-public class DragSource extends Widget {
-
- // ole interfaces
- private COMObject iUnknown;
- private COMObject iDropSource;
- private COMObject iDataObject;
- private int refCount;
-
- // info for registering as a drag source
- private Control control;
- private Transfer[] transferAgents = new Transfer[0];
-
- private Listener controlListener;
-
- private int dataEffect;
-
-/**
- * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> that the user clicks on to initiate the drag
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DragSource(Control control, int style) {
-
- super (control, checkStyle (style));
-
- this.control = control;
-
- createCOMInterfaces();
-
- this.AddRef();
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- if (event.type == SWT.Dispose){
- DragSource.this.dispose();
- }
- if (event.type == SWT.DragDetect) {
- DragSource.this.drag();
- }
- }
- };
- control.addListener (SWT.Dispose, controlListener);
- control.addListener (SWT.DragDetect, controlListener);
-
- this.addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event e) {
- onDispose();
- }
- });
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragStart, typedListener);
- addListener (DND.DragEnd, typedListener);
- addListener (DND.DragSetData, typedListener);
-
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iDropSource = new COMObject(new int[]{2, 0, 0, 2, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return QueryContinueDrag(args[0], args[1]);}
- public int method4(int[] args) {return GiveFeedback(args[0]);}
- };
-
- iDataObject = new COMObject(new int[]{2, 0, 0, 2, 2, 1, 2, 3, 2, 4, 1, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return GetData(args[0], args[1]);}
- // method4 GetDataHere - not implemented
- public int method5(int[] args) {return QueryGetData(args[0]);}
- // method6 GetCanonicalFormatEtc - not implemented
- public int method7(int[] args) {return SetData(args[0], args[1], args[2]);}
- public int method8(int[] args) {return EnumFormatEtc(args[0], args[1]);}
- // method9 DAdvise - not implemented
- // method10 DUnadvise - not implemented
- // method11 EnumDAdvise - not implemented
- };
-}
-private void onDispose () {
- this.Release();
-
- if (control != null && controlListener != null){
- control.removeListener(SWT.Dispose, controlListener);
- control.removeListener(SWT.DragDetect, controlListener);
- }
- controlListener = null;
- control = null;
-
- transferAgents = null;
-}
-private int osToOp(int osOperation){
- int operation = 0;
- if ((osOperation & COM.DROPEFFECT_COPY) != 0){
- operation |= DND.DROP_COPY;
- }
- if ((osOperation & COM.DROPEFFECT_LINK) != 0) {
- operation |= DND.DROP_LINK;
- }
- if ((osOperation & COM.DROPEFFECT_MOVE) != 0) {
- operation |= DND.DROP_MOVE;
- }
- return operation;
-
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDropSource != null)
- iDropSource.dispose();
- iDropSource = null;
-
- if (iDataObject != null)
- iDataObject.dispose();
- iDataObject = null;
-}
-private void drag() {
-
- if (transferAgents == null || getStyle() == 0) return;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.doit = true;
-
- try {
- notifyListeners(DND.DragStart,event);
- } catch (Throwable e) {
- return;
- }
-
- if (!event.doit) return;
-
- dataEffect = DND.DROP_NONE;
- int[] pdwEffect = new int[1];
- int result = COM.DoDragDrop(iDataObject.getAddress(), iDropSource.getAddress(), getStyle(), pdwEffect);
- int operation = osToOp(pdwEffect[0]);
- event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- if (dataEffect == DND.DROP_MOVE && (operation == DND.DROP_NONE || operation == DND.DROP_COPY)) {
- dataEffect = DND.DROP_TARGET_MOVE;
- }
- if (dataEffect == DND.DROP_NONE) {
- dataEffect = operation;
- }
- event.detail = dataEffect;
- event.doit = (result == COM.DRAGDROP_S_DROP);
-
- try {
- notifyListeners(DND.DragEnd,event);
- } catch (Throwable e) {
- }
-}
-
-private int EnumFormatEtc(int dwDirection, int ppenumFormatetc) {
- // only allow getting of data - SetData is not currently supported
- if (dwDirection == COM.DATADIR_SET) return COM.E_NOTIMPL;
-
- // what types have been registered?
- TransferData[] allowedDataTypes = new TransferData[0];
- for (int i = 0; i < transferAgents.length; i++){
- TransferData[] formats = transferAgents[i].getSupportedTypes();
- TransferData[] newAllowedDataTypes = new TransferData[allowedDataTypes.length + formats.length];
- System.arraycopy(allowedDataTypes, 0, newAllowedDataTypes, 0, allowedDataTypes.length);
- System.arraycopy(formats, 0, newAllowedDataTypes, allowedDataTypes.length, formats.length);
- allowedDataTypes = newAllowedDataTypes;
- }
-
- OleEnumFORMATETC enumFORMATETC = new OleEnumFORMATETC();
- enumFORMATETC.AddRef();
-
- FORMATETC[] formats = new FORMATETC[allowedDataTypes.length];
- for (int i = 0; i < formats.length; i++){
- formats[i] = allowedDataTypes[i].formatetc;
- }
- enumFORMATETC.setFormats(formats);
-
- COM.MoveMemory(ppenumFormatetc, new int[] {enumFORMATETC.getAddress()}, 4);
- return COM.S_OK;
-}
-/**
- * Returns the Control which is registered for this DragSource. This is the control that the
- * user clicks in to initiate dragging.
- *
- * @return the Control which is registered for this DragSource
- */
-public Control getControl () {
- return control;
-}
-private int GetData(int pFormatetc, int pmedium) {
- /* Called by a data consumer to obtain data from a source data object.
- The GetData method renders the data described in the specified FORMATETC
- structure and transfers it through the specified STGMEDIUM structure.
- The caller then assumes responsibility for releasing the STGMEDIUM structure.
- */
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- if (QueryGetData(pFormatetc) != COM.S_OK) return COM.DV_E_FORMATETC;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.E_FAIL;
-
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.dataType = transferData;
- try {
- notifyListeners(DND.DragSetData,event);
- } catch (Throwable e) {
- return COM.E_FAIL;
- }
-
- if (event.data == null) return COM.DV_E_FORMATETC;
-
- // get matching transfer agent to perform conversion
- Transfer transfer = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(event.dataType )){
- transfer = transferAgents[i];
- break;
- }
- }
- if (transfer == null) return COM.DV_E_FORMATETC;
-
- transfer.javaToNative(event.data, transferData);
- COM.MoveMemory(pmedium, transferData.stgmedium, STGMEDIUM.sizeof);
- return transferData.result;
-}
-
-
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-/**
- * Returns the list of data types that can be transferred by this DragSource.
- *
- * @return the list of data types that can be transferred by this DragSource
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-private int GiveFeedback(int dwEffect) {
- return COM.DRAGDROP_S_USEDEFAULTCURSORS;
-}
-
-
-private int QueryContinueDrag(int fEscapePressed, int grfKeyState) {
- if (fEscapePressed != 0)
- return COM.DRAGDROP_S_CANCEL;
- if ((grfKeyState & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0)
- return COM.DRAGDROP_S_DROP;
-
- return COM.S_OK;
-}
-private int QueryGetData(int pFormatetc) {
-
- if (transferAgents == null) return COM.E_FAIL;
-
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, pFormatetc, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- // is this type supported by the transfer agent?
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData))
- return COM.S_OK;
- }
-
- return COM.DV_E_FORMATETC;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDropSource)) {
- COM.MoveMemory(ppvObject, new int[] {iDropSource.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- if (COM.IsEqualGUID(guid, COM.IIDIDataObject) ) {
- COM.MoveMemory(ppvObject, new int[] {iDataObject.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDragListener(DragSourceListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragStart, listener);
- removeListener (DND.DragEnd, listener);
- removeListener (DND.DragSetData, listener);
-}
-private static int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect");
-private int SetData(int pFormatetc, int pmedium, int fRelease) {
-
- if (pFormatetc == 0 || pmedium == 0) return COM.E_INVALIDARG;
-
- FORMATETC formatetc = new FORMATETC();
- COM.MoveMemory(formatetc, pFormatetc, FORMATETC.sizeof);
- if (formatetc.cfFormat == CFSTR_PERFORMEDDROPEFFECT && formatetc.tymed == COM.TYMED_HGLOBAL) {
- STGMEDIUM stgmedium = new STGMEDIUM();
- COM.MoveMemory(stgmedium, pmedium,STGMEDIUM.sizeof);
- int[] ptrEffect = new int[1];
- OS.MoveMemory(ptrEffect, stgmedium.unionField,4);
- int[] effect = new int[1];
- OS.MoveMemory(effect, ptrEffect[0],4);
- dataEffect = osToOp(effect[0]);
- }
- if (fRelease == 1) {
- COM.ReleaseStgMedium(pmedium);
- }
- return COM.S_OK;
-}
-/**
- * Specifies the list of data types that can be transferred by this DragSource.
- * The application must be able to provide data to match each of these types when
- * a successful drop has occurred.
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DragSource.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
deleted file mode 100755
index c12c26c2b0..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/DropTarget.java
+++ /dev/null
@@ -1,609 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.*;
-
-/**
- *
- * Class <code>DropTarget</code> defines the target object for a drag and drop transfer.
- *
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- *
- * <p>This class identifies the <code>Control</code> over which the user must position the cursor
- * in order to drop the data being transferred. It also specifies what data types can be dropped on
- * this control and what operations can be performed. You may have several DropTragets in an
- * application but there can only be a one to one mapping between a <code>Control</code> and a <code>DropTarget</code>.
- * The DropTarget can receive data from within the same application or from other applications
- * (such as text dragged from a text editor like Word).</p>
- *
- * <code><pre>
- * int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
- * Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
- * DropTarget target = new DropTarget(label, operations);
- * target.setTransfer(types);
- * </code></pre>
- *
- * <p>The application is notified of data being dragged over this control and of when a drop occurs by
- * implementing the interface <code>DropTargetListener</code> which uses the class
- * <code>DropTargetEvent</code>. The application can modify the type of drag being performed
- * on this Control at any stage of the drag by modifying the <code>event.detail</code> field or the
- * <code>event.currentDataType</code> field. When the data is dropped, it is the responsibility of
- * the application to copy this data for its own purposes.
- *
- * <code><pre>
- * target.addDropListener (new DropTargetListener() {
- * public void dragEnter(DropTargetEvent event) {};
- * public void dragOver(DropTargetEvent event) {};
- * public void dragLeave(DropTargetEvent event) {};
- * public void dragOperationChanged(DropTargetEvent event) {};
- * public void dropAccept(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * // A drop has occurred, copy over the data
- * if (event.data == null) { // no data to copy, indicate failure in event.detail
- * event.detail = DND.DROP_NONE;
- * return;
- * }
- * label.setText ((String) event.data); // data copied to label text
- * }
- * });
- * </pre></code>
- *
- * <dl>
- * <dt><b>Styles</b> <dd>DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- * <dt><b>Events</b> <dd>DND.DragEnter, DND.DragLeave, DND.DragOver, DND.DragOperationChanged,
- * DND.Drop, DND.DropAccept
- * </dl>
- */
-
-public class DropTarget extends Widget {
-
-
- // interfaces
- private COMObject iUnknown;
- private COMObject iDropTarget;
-
- // info for registering as a droptarget
- private Control control;
- private Listener controlListener;
-
- private Transfer[] transferAgents = new Transfer[0];;
-
- private int refCount;
-
- // info about data being dragged over site
- private TransferData selectedDataType;
- private TransferData[] dataTypes;
- private int lastOperation;
- private int keyState;
-
- private DragUnderEffect effect;
-
- private int iDataObject;
-
-/**
- * Creates a new <code>DropTarget</code> to handle dropping on the specified <code>Control</code>.
- *
- * @param control the <code>Control</code> over which the user positions the cursor to drop data
- *
- * @param style the bitwise OR'ing of allowed operations; this may be a combination of any of
- * DND.DROP_NONE, DND.DROP_COPY, DND.DROP_MOVE, DND.DROP_LINK
- *
- */
-public DropTarget(Control control, int style) {
-
- super (control, checkStyle(style));
-
- this.control = control;
-
- createCOMInterfaces();
-
- int result = 0;
- if ((result = COM.CoLockObjectExternal(iDropTarget.getAddress(), true, true)) != COM.S_OK)
- DND.error(DND.ERROR_CANNOT_INIT_DROP, result);
- if ((result = COM.RegisterDragDrop( control.handle, iDropTarget.getAddress() )) != COM.S_OK)
- DND.error(DND.ERROR_CANNOT_INIT_DROP, result);
-
- controlListener = new Listener () {
- public void handleEvent (Event event) {
- DropTarget.this.dispose();
- }
- };
-
- control.addListener (SWT.Dispose, controlListener);
-
- this.addListener (SWT.Dispose, new Listener () {
- public void handleEvent (Event event) {
- onDispose();
- }
- });
-
- if (control instanceof Tree) {
- effect = new TreeDragUnderEffect((Tree)control);
- } else if (control instanceof Table) {
- effect = new TableDragUnderEffect((Table)control);
- } else {
- effect = new NoDragUnderEffect(control);
- }
-}
-/**
- * Adds the listener to receive events.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void addDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- DNDListener typedListener = new DNDListener (listener);
- addListener (DND.DragEnter, typedListener);
- addListener (DND.DragLeave, typedListener);
- addListener (DND.DragOver, typedListener);
- addListener (DND.DragOperationChanged, typedListener);
- addListener (DND.Drop, typedListener);
- addListener (DND.DropAccept, typedListener);
-
-}
-private int AddRef() {
- refCount++;
- return refCount;
-}
-static int checkStyle (int style) {
- if (style == SWT.NONE) return DND.DROP_MOVE;
- return style;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[]{2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
-
- iDropTarget = new COMObject(new int[]{2, 0, 0, 5, 4, 0, 5}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return DragEnter(args[0], args[1], args[2], args[3], args[4]);}
- public int method4(int[] args) {return DragOver(args[0], args[1], args[2], args[3]);}
- public int method5(int[] args) {return DragLeave();}
- public int method6(int[] args) {return Drop(args[0], args[1], args[2], args[3], args[4]);}
- };
-
-}
-private void onDispose () {
- if (control == null) return;
-
- COM.RevokeDragDrop(control.handle);
-
- if (controlListener != null)
- control.removeListener(SWT.Dispose, controlListener);
- controlListener = null;
- transferAgents = null;
- control = null;
-
- COM.CoLockObjectExternal(iDropTarget.getAddress(), false, true);
-
- this.Release();
-
- COM.CoFreeUnusedLibraries();
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iDropTarget != null)
- iDropTarget.dispose();
- iDropTarget = null;
-}
-private int DragEnter(
- int pDataObject, //Pointer to the interface of the source data object
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y, //Current cursor coordinates
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
-
- selectedDataType = null;
- dataTypes = new TransferData[0];
- iDataObject = 0;
- lastOperation = DND.DROP_NONE;
-
- // Are any types being dragged for which we have a matching transfer object?
- // Get enumerator of dragged types
- IDataObject dataObject = new IDataObject(pDataObject);
- dataObject.AddRef();
- int[] address = new int[1];
- if (dataObject.EnumFormatEtc(COM.DATADIR_GET, address) != COM.S_OK){
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- dataObject.Release();
- return COM.S_OK;
- }
- IEnumFORMATETC enum = new IEnumFORMATETC(address[0]);
- dataObject.Release();
- iDataObject = pDataObject;
-
- // Loop over enumerator and save any types that match what we are looking for
- int rgelt = OS.GlobalAlloc(OS.GMEM_FIXED | OS.GMEM_ZEROINIT, FORMATETC.sizeof);
- int[] pceltFetched = new int[1];
- enum.Reset();
- while (enum.Next(1, rgelt, pceltFetched) == COM.S_OK && pceltFetched[0] == 1) {
- TransferData transferData = new TransferData();
- transferData.formatetc = new FORMATETC();
- COM.MoveMemory(transferData.formatetc, rgelt, FORMATETC.sizeof);
- transferData.type = transferData.formatetc.cfFormat;
-
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(transferData)){
- TransferData[] newDataTypes = new TransferData[dataTypes.length + 1];
- System.arraycopy(dataTypes, 0, newDataTypes, 0, dataTypes.length);
- newDataTypes[dataTypes.length] = transferData;
- dataTypes = newDataTypes;
- break;
- }
- }
- }
- OS.GlobalFree(rgelt);
- enum.Release();
-
- // give listeners a chance to have input
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- if (dataTypes.length > 0) {
- event.dataType = dataTypes[0];
- event.dataType.pIDataObject = pDataObject;
- }
- event.detail = DND.DROP_NONE;
- // assign operation if it is allowed
- keyState = osToOp(getOperationFromKeyState(grfKeyState));
- if ((keyState & getStyle()) == keyState){
- event.detail = keyState;
- }
-
- try {
- notifyListeners(DND.DragEnter,event);
- } catch (Throwable e) {
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- return COM.S_OK;
- }
-
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
- if (selectedDataType != null && ((allowedEffects[0] & event.detail) == event.detail)) {
- lastOperation = event.detail;
- }
-
- effect.show(event.feedback, event.x, event.y);
-
- OS.MoveMemory(pdwEffect, new int[] {opToOs(lastOperation)}, 4);
- return COM.S_OK;
-}
-private int DragLeave()
-{
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- keyState = DND.DROP_NONE;
-
- // give listeners a chance to react
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.detail = DND.DROP_NONE;
- try {
- notifyListeners(DND.DragLeave, event);
- } catch (Throwable e) {}
-
- return COM.S_OK;
-}
-private int DragOver(
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y,
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- event.feedback = DND.FEEDBACK_SELECT;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- event.dataType = selectedDataType;
- if (event.dataType != null) {
- event.dataType.pIDataObject = iDataObject;
- }
-
- try {
- int oldKeyState = keyState;
- keyState = osToOp(getOperationFromKeyState(grfKeyState));
- if (keyState == oldKeyState) {
- event.detail = lastOperation;
- // update with new drag over info
- notifyListeners(DND.DragOver,event);
- } else {
- event.detail = keyState;
- // operation has changed
- notifyListeners(DND.DragOperationChanged, event);
- }
- } catch (Throwable e) {
- OS.MoveMemory(pdwEffect, new int[] {COM.DROPEFFECT_NONE}, 4);
- return COM.S_OK;
- }
-
- // update drop data and drag under effect based on response from event
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
-
- lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && ((allowedEffects[0] & event.detail) == event.detail)) {
- lastOperation = event.detail;
- }
-
- effect.show(event.feedback, event.x, event.y);
-
- OS.MoveMemory(pdwEffect, new int[] {opToOs(lastOperation)}, 4);
- return COM.S_OK;
-}
-private int Drop(
- int pDataObject, //Pointer to the interface for the source data
- int grfKeyState, //Current state of keyboard modifier keys
- int pt_x, //Current cursor coordinates
- int pt_y,
- int pdwEffect //Pointer to the effect of the drag-and-drop operation
-){
-
- effect.show(DND.FEEDBACK_NONE, 0, 0);
- keyState = DND.DROP_NONE;
-
- // Send a DragLeave event to be consistant with Motif
- DNDEvent event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.detail = DND.DROP_NONE;
- try {
- notifyListeners(DND.DragLeave, event);
- } catch (Throwable e) {}
-
- // Send a DropAccept event to be consistant with Motif
- event = new DNDEvent();
- event.widget = this;
- event.time = OS.GetMessageTime();
- event.x = pt_x;
- event.y = pt_y;
- event.dataTypes = dataTypes;
- int[] allowedEffects = new int[1];
- OS.MoveMemory(allowedEffects, pdwEffect, 4);
- allowedEffects[0] = osToOp(allowedEffects[0]);
- event.operations = allowedEffects[0];
- event.dataType = selectedDataType;
- if (event.dataType != null) {
- event.dataType.pIDataObject = iDataObject;
- }
- event.detail = lastOperation;
-
- try {
- notifyListeners(DND.DropAccept,event);
- } catch (Throwable e) {
- event.dataType = null;
- event.detail = DND.DROP_NONE;
- }
-
- selectedDataType = null;
- for (int i = 0; i < dataTypes.length; i++) {
- if (dataTypes[i].equals(event.dataType)){
- selectedDataType = event.dataType;
- break;
- }
- }
- lastOperation = DND.DROP_NONE;
- if (selectedDataType != null && (allowedEffects[0] & event.detail) == event.detail) {
- lastOperation = event.detail;
- }
-
- if (lastOperation != DND.DROP_NONE){
- // find the matching converter
- Transfer matchingTransfer = null;
- for (int i = 0; i < transferAgents.length; i++){
- if (transferAgents[i].isSupportedType(event.dataType)){
- matchingTransfer = transferAgents[i];
- break;
- }
- }
- if (matchingTransfer == null){
- lastOperation = DND.DROP_NONE;
- } else {
- event.dataType.pIDataObject = pDataObject;
- Object data = matchingTransfer.nativeToJava(event.dataType);
- event.data = data;
- try {
- notifyListeners(DND.Drop,event);
- lastOperation = DND.DROP_NONE;
- if ((allowedEffects[0] & event.detail) == event.detail) {
- lastOperation = event.detail;
- }
- } catch (Throwable e) {
- lastOperation = DND.DROP_NONE;
- }
-
- }
- }
-
- OS.MoveMemory(pdwEffect, new int[] {osToOp(lastOperation)}, 4);
- return COM.S_OK;
-}
-/**
- * Returns the Control which is registered for this DropTarget. This is the control over which the
- * user positions the cursor to drop the data.
- *
- * @return the Control which is registered for this DropTarget
- *
- */
-public Control getControl () {
- return control;
-}
-public Display getDisplay () {
-
- if (control == null) DND.error(SWT.ERROR_WIDGET_DISPOSED);
- return control.getDisplay ();
-}
-private int getOperationFromKeyState(int grfKeyState) {
- boolean ctrl = (grfKeyState & OS.MK_CONTROL) != 0;
- boolean shift = (grfKeyState & OS.MK_SHIFT) != 0;
- if (ctrl && shift) {
- // CTRL + SHIFT == Link
- return COM.DROPEFFECT_LINK;
- }
- if (ctrl){
- //CTRL == COPY
- return COM.DROPEFFECT_COPY;
- }
-
- return COM.DROPEFFECT_MOVE; // default operation
-}
-/**
- * Returns the list of data types that can be transferred to this DropTarget.
- *
- * @return the list of data types that can be transferred to this DropTarget
- *
- */
-public Transfer[] getTransfer(){
- return transferAgents;
-}
-public void notifyListeners (int eventType, Event event) {
- Point coordinates = new Point(event.x, event.y);
- coordinates = control.toControl(coordinates);
- if (this.control instanceof Tree) {
- event.item = ((Tree)control).getItem(coordinates);
- }
- if (this.control instanceof Table) {
- event.item = ((Table)control).getItem(coordinates);
- }
- super.notifyListeners(eventType, event);
-}
-private int opToOs(int operation) {
- int osOperation = 0;
- if ((operation & DND.DROP_COPY) != 0){
- osOperation |= COM.DROPEFFECT_COPY;
- }
- if ((operation & DND.DROP_LINK) != 0) {
- osOperation |= COM.DROPEFFECT_LINK;
- }
- if ((operation & DND.DROP_MOVE) != 0) {
- osOperation |= COM.DROPEFFECT_MOVE;
- }
- return osOperation;
-}
-private int osToOp(int osOperation){
- int operation = 0;
- if ((osOperation & COM.DROPEFFECT_COPY) != 0){
- operation |= DND.DROP_COPY;
- }
- if ((osOperation & COM.DROPEFFECT_LINK) != 0) {
- operation |= DND.DROP_LINK;
- }
- if ((osOperation & COM.DROPEFFECT_MOVE) != 0) {
- operation |= DND.DROP_MOVE;
- }
- return operation;
-
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0)
- return COM.E_INVALIDARG;
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIDropTarget)) {
- COM.MoveMemory(ppvObject, new int[] {iDropTarget.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
-
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-private int Release() {
- refCount--;
-
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-/**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
-public void removeDropListener(DropTargetListener listener) {
- if (listener == null) DND.error (SWT.ERROR_NULL_ARGUMENT);
- removeListener (DND.DragEnter, listener);
- removeListener (DND.DragLeave, listener);
- removeListener (DND.DragOver, listener);
- removeListener (DND.DragOperationChanged, listener);
- removeListener (DND.Drop, listener);
- removeListener (DND.DropAccept, listener);
-}
-/**
- * Specifies the list of data types that can be transferred to this DropTarget.
- *
- * @param transferAgents a list of Transfer objects which define the types of data that can be
- * dropped on this target
- */
-public void setTransfer(Transfer[] transferAgents){
- this.transferAgents = transferAgents;
-}
-
-protected void checkSubclass () {
- String name = getClass().getName ();
- String validName = DropTarget.class.getName();
- if (!validName.equals(name)) {
- DND.error (SWT.ERROR_INVALID_SUBCLASS);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java
deleted file mode 100755
index ec11a1df68..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/FileTransfer.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-import org.eclipse.swt.internal.win32.TCHAR;
-import org.eclipse.swt.internal.win32.DROPFILES;
-
-/**
- * The <code>FileTransfer</code> class is used to transfer files in a drag and drop operation.
- */
-public class FileTransfer extends ByteArrayTransfer {
-
- private static FileTransfer _instance = new FileTransfer();
-
-private FileTransfer() {}
-/**
- * Returns the singleton instance of the FileTransfer class.
- *
- * @return the singleton instance of the FileTransfer class
- */
-public static FileTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a list of filenames to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a list of file names
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative(Object object, TransferData transferData) {
-
- if (object == null || !(object instanceof String[])) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- if (isSupportedType(transferData)) {
-
- String[] fileNames = (String[]) object;
- StringBuffer allFiles = new StringBuffer();
- for (int i = 0; i < fileNames.length; i++) {
- allFiles.append(fileNames[i]);
- allFiles.append('\0'); // each name is null terminated
- }
- TCHAR buffer = new TCHAR(0, allFiles.toString(), true); // there is an extra null terminator at the very end
-
- DROPFILES dropfiles = new DROPFILES();
- dropfiles.pFiles = DROPFILES.sizeof;
- dropfiles.pt_x = dropfiles.pt_y = 0;
- dropfiles.fNC = 0;
- dropfiles.fWide = COM.IsUnicode ? 1 : 0;
-
- // Allocate the memory because the caller (DropTarget) has not handed it in
- // The caller of this method must release the data when it is done with it.
- int byteCount = buffer.length() * TCHAR.sizeof;
- int newPtr = COM.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, DROPFILES.sizeof + byteCount);
- COM.MoveMemory(newPtr, dropfiles, DROPFILES.sizeof);
- COM.MoveMemory(newPtr + DROPFILES.sizeof, buffer, byteCount);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-}
-/**
- * Converts a platform specific representation of a list of file names to a Java array of String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java array of String containing a list of file names if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData) {
-
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- // get file names from IDataObject
- IDataObject dataObject = new IDataObject(transferData.pIDataObject);
- dataObject.AddRef();
-
- FORMATETC formatetc = new FORMATETC();
- formatetc.cfFormat = COM.CF_HDROP;
- formatetc.ptd = 0;
- formatetc.dwAspect = COM.DVASPECT_CONTENT;
- formatetc.lindex = -1;
- formatetc.tymed = COM.TYMED_HGLOBAL;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
-
- transferData.result = dataObject.GetData(formatetc, stgmedium);
- dataObject.Release();
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- // How many files are there?
- int count = COM.DragQueryFile(stgmedium.unionField, 0xFFFFFFFF, null, 0);
- String[] fileNames = new String[count];
- for (int i = 0; i < count; i++){
- // How long is the name ?
- int size = COM.DragQueryFile(stgmedium.unionField, i, null, 0) + 1;
- TCHAR lpszFile = new TCHAR(0, size);
- // Get file name and append it to string
- COM.DragQueryFile(stgmedium.unionField, i, lpszFile, size);
- fileNames[i] = lpszFile.toString(0, lpszFile.strlen());
- }
- COM.DragFinish(stgmedium.unionField); // frees data associated with HDROP data
- return fileNames;
-}
-protected int[] getTypeIds(){
- return new int[] {COM.CF_HDROP};
-}
-protected String[] getTypeNames(){
- return new String[] {"CF_HDROP"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
deleted file mode 100755
index 80b8bc248b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/OleEnumFORMATETC.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.internal.ole.win32.*;
-
-final class OleEnumFORMATETC {
-
- private COMObject iUnknown;
- private COMObject iEnumFORMATETC;
-
- private int refCount;
- private int index;
-
- private FORMATETC[] formats;
-
-OleEnumFORMATETC() {
-
- createCOMInterfaces();
-
-}
-int AddRef() {
- refCount++;
- return refCount;
-}
-private void createCOMInterfaces() {
- // register each of the interfaces that this object implements
- iUnknown = new COMObject(new int[] {2, 0, 0}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- };
- iEnumFORMATETC = new COMObject(new int[] {2, 0, 0, 3, 1, 0, 1}){
- public int method0(int[] args) {return QueryInterface(args[0], args[1]);}
- public int method1(int[] args) {return AddRef();}
- public int method2(int[] args) {return Release();}
- public int method3(int[] args) {return Next(args[0], args[1], args[2]);}
- public int method4(int[] args) {return Skip(args[0]);}
- public int method5(int[] args) {return Reset();}
- // method6 Clone - not implemented
- };
-}
-private void disposeCOMInterfaces() {
-
- if (iUnknown != null)
- iUnknown.dispose();
- iUnknown = null;
-
- if (iEnumFORMATETC != null)
- iEnumFORMATETC.dispose();
- iEnumFORMATETC = null;
-}
-int getAddress() {
- return iEnumFORMATETC.getAddress();
-}
-private FORMATETC[] getNextItems(int numItems){
-
- if (formats == null || numItems < 1) return null;
-
- int endIndex = index + numItems - 1;
- if (endIndex > (formats.length - 1)) endIndex = formats.length - 1;
- if (index > endIndex) return null;
-
- FORMATETC[] items = new FORMATETC[endIndex - index + 1];
- for (int i = 0; i < items.length; i++){
- items[i] = formats[index];
- index++;
- }
-
- return items;
-}
-private int Next(int celt, int rgelt, int pceltFetched) {
- /* Retrieves the next celt items in the enumeration sequence.
- If there are fewer than the requested number of elements left in the sequence,
- it retrieves the remaining elements.
- The number of elements actually retrieved is returned through pceltFetched
- (unless the caller passed in NULL for that parameter).
- */
-
- if (rgelt == 0) return COM.E_INVALIDARG;
- if (pceltFetched == 0 && celt != 1) return COM.E_INVALIDARG;
-
- FORMATETC[] nextItems = getNextItems(celt);
- if (nextItems != null) {
- for (int i = 0; i < nextItems.length; i++) {
- COM.MoveMemory(rgelt + i*FORMATETC.sizeof, nextItems[i], FORMATETC.sizeof);
- }
-
- if (pceltFetched != 0)
- COM.MoveMemory(pceltFetched, new int[] {nextItems.length}, 4);
-
- if (nextItems.length == celt) return COM.S_OK;
-
- } else {
- if (pceltFetched != 0)
- COM.MoveMemory(pceltFetched, new int[] {0}, 4);
- COM.MoveMemory(rgelt, new FORMATETC(), FORMATETC.sizeof);
-
- }
- return COM.S_FALSE;
-}
-private int QueryInterface(int riid, int ppvObject) {
-
- if (riid == 0 || ppvObject == 0) return COM.E_NOINTERFACE;
-
- GUID guid = new GUID();
- COM.MoveMemory(guid, riid, GUID.sizeof);
-
- if (COM.IsEqualGUID(guid, COM.IIDIUnknown)) {
- COM.MoveMemory(ppvObject, new int[] {iUnknown.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- if (COM.IsEqualGUID(guid, COM.IIDIEnumFORMATETC)) {
- COM.MoveMemory(ppvObject, new int[] {iEnumFORMATETC.getAddress()}, 4);
- AddRef();
- return COM.S_OK;
- }
- COM.MoveMemory(ppvObject, new int[] {0}, 4);
- return COM.E_NOINTERFACE;
-}
-int Release() {
- refCount--;
-
- if (refCount == 0) {
- disposeCOMInterfaces();
- COM.CoFreeUnusedLibraries();
- }
-
- return refCount;
-}
-private int Reset() {
- //Resets the enumeration sequence to the beginning.
- index = 0;
- return COM.S_OK;
-}
-void setFormats(FORMATETC[] newFormats) {
- formats = newFormats;
- index = 0;
-}
-private int Skip(int celt) {
- //Skips over the next specified number of elements in the enumeration sequence.
- if (celt < 1 ) return COM.E_INVALIDARG;
-
- index += celt;
- if (index > (formats.length - 1)){
- index = formats.length - 1;
- return COM.S_FALSE;
- }
- return COM.S_OK;
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
deleted file mode 100755
index 3dba0b73db..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-/**
- * The <code>RTFTransfer</code> class is used to transfer text with the RTF format
- * in a drag and drop operation.
- */
-public class RTFTransfer extends ByteArrayTransfer {
-
- private static final String CF_RTF_NAME = "Rich Text Format";
- private static final int CF_RTF = registerType(CF_RTF_NAME);
- private static RTFTransfer _instance = new RTFTransfer();
-
-private RTFTransfer() {}
-/**
- * Returns the singleton instance of the RTFTransfer class.
- *
- * @return the singleton instance of the RTFTransfer class
- */
-public static RTFTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a RTF-formatted Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) return;
-
- // CF_RTF is stored as a null terminated byte array
- // create a byte array from object
- String text = (String) object+'\0';
- // pass byte array on to super to convert to native
- super.javaToNative(text.getBytes(), transferData);
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- // get byte array from super
- byte[] buffer = (byte[])super.nativeToJava(transferData);
- if (buffer == null) return null;
- // convert byte array to a string
- String string = new String(buffer);
- // remove null terminator
- int index = string.indexOf("\0");
- string = string.substring(0, index);
- return string;
-}
-protected int[] getTypeIds(){
- return new int[] {CF_RTF};
-}
-protected String[] getTypeNames(){
- return new String[] {"CF_RTF"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
deleted file mode 100755
index 93cd62e919..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TableDragUnderEffect.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.LVITEM;
-import org.eclipse.swt.internal.win32.OS;
-
-class TableDragUnderEffect extends DragUnderEffect {
- private Table table;
- private TableItem[] selection = new TableItem[0];
- int currentEffect = DND.FEEDBACK_NONE;
-// private TableItem dropSelection
- private TableItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
-
-TableDragUnderEffect(Table table) {
- this.table = table;
-}
-void show(int effect, int x, int y) {
- TableItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = table.getSelection();
- table.deselectAll();
- }
- scrollHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- table.setSelection(selection);
- selection = new TableItem[0];
- }
- currentEffect = effect;
-}
-private TableItem findItem(int x, int y){
- if (table == null) return null;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- TableItem item = table.getItem(coordinates);
- if (item != null) return item;
-
- Rectangle area = table.getClientArea();
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- coordinates = new Point(x1, y);
- coordinates = table.toControl(coordinates);
- item = table.getItem(coordinates);
- if (item != null) return item;
- }
- return null;
-
-}
-private void setDragUnderEffect(int effect, TableItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(item);
- } else {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- }
-}
-private void setDropSelection (TableItem item) {
-// if (item == dropSelection) return;
-// if (dropSelection != null) table.deselectAll();
-// dropSelection = item;
-// if (dropSelection != null) table.setSelection(new TableItem[]{dropSelection});
-
- LVITEM lvItem = new LVITEM ();
- lvItem.stateMask = OS.LVIS_DROPHILITED;
- // remove all drop highlighting
- OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, -1, lvItem);
- if (item != null) {
- lvItem.state = OS.LVIS_DROPHILITED;
- int index = table.indexOf(item);
- OS.SendMessage (table.handle, OS.LVM_SETITEMSTATE, index, lvItem);
- }
-}
-private void scrollHover (int effect, TableItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TableItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = table.toControl(coordinates);
- Rectangle area = table.getClientArea();
- TableItem showItem = null;
- int itemIndex = table.indexOf(item);
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = table.getItem(Math.max(0, itemIndex - 1));
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = table.getItem(Math.min(table.getItemCount() - 1, itemIndex + 1));
- }
- if (showItem != null) {
- table.showItem(showItem);
- }
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
deleted file mode 100755
index c13190749b..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.COM;
-import org.eclipse.swt.internal.win32.TCHAR;
-import org.eclipse.swt.internal.ole.win32.STGMEDIUM;
-import org.eclipse.swt.internal.ole.win32.FORMATETC;
-import org.eclipse.swt.internal.ole.win32.IDataObject;
-
-/**
- * The <code>TextTransfer</code> class is used to transfer text in a drag and drop operation.
- */
-public class TextTransfer extends ByteArrayTransfer {
-
- private static TextTransfer _instance = new TextTransfer();
-private TextTransfer() {}
-
-/**
- * Returns the singleton instance of the TextTransfer class.
- *
- * @return the singleton instance of the TextTransfer class
- */
-public static TextTransfer getInstance () {
- return _instance;
-}
-/**
- * Converts a plain text Java String to a platform specific representation.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java String containing the data to be transferred
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific format of the data
- */
-public void javaToNative (Object object, TransferData transferData){
- if (object == null || !(object instanceof String)) {
- transferData.result = COM.E_FAIL;
- return;
- }
-
- if (isSupportedType(transferData)) {
- TCHAR buffer = new TCHAR(0, (String)object, true);
- int byteCount = buffer.length() * TCHAR.sizeof;
- int newPtr = COM.GlobalAlloc(COM.GMEM_FIXED | COM.GMEM_ZEROINIT, byteCount);
- COM.MoveMemory(newPtr, buffer, byteCount);
-
- transferData.stgmedium = new STGMEDIUM();
- transferData.stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.stgmedium.unionField = newPtr;
- transferData.stgmedium.pUnkForRelease = 0;
- transferData.result = COM.S_OK;
- return;
- }
-
- // did not match the TYMED
- transferData.stgmedium = new STGMEDIUM();
- transferData.result = COM.DV_E_TYMED;
-
-}
-/**
- * Converts a platform specific representation of a string to a Java String.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- * @return a Java String containing the transferred data if the conversion was successful;
- * otherwise null
- */
-public Object nativeToJava(TransferData transferData){
- if (!isSupportedType(transferData) || transferData.pIDataObject == 0) {
- transferData.result = COM.E_FAIL;
- return null;
- }
-
- IDataObject data = new IDataObject(transferData.pIDataObject);
- data.AddRef();
-
- FORMATETC formatetc = transferData.formatetc;
-
- STGMEDIUM stgmedium = new STGMEDIUM();
- stgmedium.tymed = COM.TYMED_HGLOBAL;
- transferData.result = data.GetData(formatetc, stgmedium);
- data.Release();
-
- if (transferData.result != COM.S_OK) {
- return null;
- }
-
- int size = COM.GlobalSize(stgmedium.unionField);
- TCHAR buffer = new TCHAR(0, size / TCHAR.sizeof);
- int ptr = COM.GlobalLock(stgmedium.unionField);
- COM.MoveMemory(buffer, ptr, size);
- COM.GlobalUnlock(ptr);
- COM.GlobalFree(stgmedium.unionField);
- return buffer.toString(0, buffer.strlen());
-}
-protected int[] getTypeIds(){
- return new int[] {COM.IsUnicode ? COM.CF_UNICODETEXT : COM.CF_TEXT};
-}
-protected String[] getTypeNames(){
- return new String[] {COM.IsUnicode ? "CF_UNICODETEXT" : "CF_TEXT"};
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java
deleted file mode 100755
index ba9fc63d37..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/Transfer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.COM;
-import org.eclipse.swt.internal.win32.TCHAR;
-
-/**
- * The class <code>Transfer</code> provides a mechanism for converting a Java object to a
- * platform specific format that can be passed around in a Drag and Drop operation and vice versa.
- *
- * <p>You should only need to become familiar with this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public abstract class Transfer {
-
-/**
- * Returns a list of the data types that can be transferred using this Transfer agent.
- *
- * <p>Only the data type fields of the TransferData Object are filled in.</p>
- *
- * @return a list of the data types that can be transferred using this Transfer agent
- */
-abstract public TransferData[] getSupportedTypes();
-/**
- * Returns true if the transferData data type can be transferred using this Transfer agent.
- *
- * @param transferData a platform specific description of a data type; only the data type fields
- * of the TransferData Object need to be filled in
- *
- * @return true if the transferData data type can be transferred using this Transfer agent
- */
-abstract public boolean isSupportedType(TransferData transferData);
-
-abstract protected int[] getTypeIds();
-abstract protected String[] getTypeNames();
-
-/**
- * Converts a Java Object to a platform specific representation of the data.
- * <p>
- * On a successful conversion, the transferData.result field will be set as follows:
- * <ul>
- * <li>Windows: OLE.S_OK
- * <li>Motif: 0
- * </ul>
- * If this transfer agent is unable to perform the conversion,
- * the transferData.result field will be set to a failure value as follows:
- * <ul>
- * <li>Windows: OLE.DV_E_TYMED
- * <li>Motif: 1
- * </ul></p>
- *
- * @param object a Java Object containing the data to be transferred
- *
- * @param transferData an empty TransferData object; this object will be filled in on return
- * with the platform specific representation of the data
- */
- abstract protected void javaToNative (Object object, TransferData transferData);
-
-/**
- * Converts a platform specific representation of data to a Java Object.
- *
- * @param transferData the platform specific representation of the data that has been transferred
- *
- * @return a Java Object containing the transferred data if the conversion was successful;
- * otherwise null
- */
- abstract protected Object nativeToJava(TransferData transferData);
-
-/**
- * Registers a name for a data type and returns the associated unique identifier.
- *
- * <p>You may register the same type more than once, the same unique identifier will be returned if the
- * type has been previously registered.</p>
- *
- * <p>Note: Do <b>not</b> call this method with pre-defined Clipboard Format types such as CF_TEXT
- * or CF_BITMAP because the pre-defined value will not be returned</p>
- *
- * @param formatName the name of a data type
- *
- * @return the unique identifier associated with htis data type
- */
-public static int registerType(String formatName){
- // Look name up in the registry
- // If name is not in registry, add it and return assigned value.
- // If name already exists in registry, return its assigned value
- TCHAR chFormatName = new TCHAR(0, formatName, true);
- return COM.RegisterClipboardFormat(chFormatName);
-}
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java
deleted file mode 100755
index 434a1682c6..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TransferData.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.internal.ole.win32.*;
-
-/**
- * The <code>TransferData</code> class is a platform specific data structure for describing the type and the
- * contents of data being transferred in a Drag and Drop operation.
- *
- * <p>As an application writer, you do not need to know anything about the specifics of TransferData. You
- * should just pass the TransferData instances to subclass of Transfer and let the Transfer objects deal
- * with the platform specific issues. You can ask a Transfer subclass if it can handle this data by calling
- * TextTransfer.isSupportedType(transferData). You can get a list of the types of TransferData supported by a
- * Transfer object by calling TextTransfer.getSupportedTypes().</p>
- *
- * <p>You should only need to become familiar with the fields in this class if you are implementing
- * a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.</p>
- */
-public class TransferData {
- /**
- * Data Type - a pre-defined clipboard format <b>or</b> the unique identifier of a user defined format
- * (Warning: This field is platform dependent)
- */
- public int type;
-
- /* Not Javadoc
- * Data Type - a Windows format structure which describes additional aspects of the type
- * (Warning: This field is platform dependent)
- */
- public FORMATETC formatetc;
-
- /* Not Javadoc
- * Set Data - a data storage structure which you update to contain the data to be transferred in the
- * (Warning: This field is platform dependent)
- */
- public STGMEDIUM stgmedium;
-
- /* Not Javadoc
- * Set Data - the result of converting a Java object into an stgmedium value
- * (Warning: This field is platform dependent)
- */
- public int result = COM.E_FAIL;
-
- /* Not Javadoc
- * Get Data - the address of an IDataObject OLE Interface which contains the data that was transferred
- * (Warning: This field is platform dependent)
- */
- public int pIDataObject;
-
-}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java
deleted file mode 100755
index 67337fb865..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TreeDragUnderEffect.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package org.eclipse.swt.dnd;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved
- */
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.internal.win32.OS;
-import org.eclipse.swt.internal.win32.TVITEM;
-import org.eclipse.swt.SWT;
-
-class TreeDragUnderEffect extends DragUnderEffect {
-
- private Tree tree;
- private int currentEffect = DND.FEEDBACK_NONE;
- private TreeItem[] selection = new TreeItem[0];
-// private TreeItem dropSelection = null;
- private TreeItem scrollItem;
- private long scrollBeginTime;
- private static final int SCROLL_HYSTERESIS = 400; // milli seconds
- private static final int SCROLL_WIDTH = 100; // pixels
- private TreeItem expandItem;
- private long expandBeginTime;
- private static final int EXPAND_HYSTERESIS = 1000; // milli seconds
-
-TreeDragUnderEffect(Tree tree) {
- this.tree = tree;
-}
-void show(int effect, int x, int y) {
- effect = checkEffect(effect);
- TreeItem item = findItem(x, y);
- if (item == null) effect = DND.FEEDBACK_NONE;
- if (currentEffect == DND.FEEDBACK_NONE && effect != DND.FEEDBACK_NONE) {
- selection = tree.getSelection();
- tree.deselectAll();
- }
- scrollHover(effect, item, x, y);
- expandHover(effect, item, x, y);
- setDragUnderEffect(effect, item);
- if (currentEffect != DND.FEEDBACK_NONE && effect == DND.FEEDBACK_NONE) {
- tree.setSelection(selection);
- selection = new TreeItem[0];
- }
- currentEffect = effect;
-
-}
-private int checkEffect(int effect) {
- // Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified.
- int mask = DND.FEEDBACK_INSERT_AFTER | DND.FEEDBACK_INSERT_BEFORE | DND.FEEDBACK_SELECT;
- int bits = effect & mask;
- if (bits == DND.FEEDBACK_INSERT_AFTER || bits == DND.FEEDBACK_INSERT_BEFORE || bits == DND.FEEDBACK_SELECT) return effect;
- return (effect & ~mask);
-}
-private TreeItem findItem(int x, int y){
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- if (!area.contains(coordinates)) return null;
-
- TreeItem item = tree.getItem(coordinates);
- if (item != null) return item;
-
- // Scan across the width of the tree.
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- Point pt = new Point(x1, coordinates.y);
- item = tree.getItem(pt);
- if (item != null) return item;
- }
- // Check if we are just below the last item of the tree
- if (coordinates.y > area.y + area.height - tree.getItemHeight()) {;
- int y1 = area.y + area.height - tree.getItemHeight();
- Point pt = new Point(coordinates.x, y1);
- item = tree.getItem(pt);
- if (item != null) return item;
-
- // Scan across the width of the tree just above the bottom..
- for (int x1 = area.x; x1 < area.x + area.width; x1++) {
- pt = new Point(x1, y1);
- item = tree.getItem(pt);
- if (item != null) return item;
- }
- }
- return null;
-}
-private void setDragUnderEffect(int effect, TreeItem item) {
- if ((effect & DND.FEEDBACK_SELECT) != 0) {
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- setDropSelection(item);
- return;
- }
- if ((effect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (effect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
- tree.setInsertMark(item, (effect & DND.FEEDBACK_INSERT_BEFORE) != 0);
- return;
- }
- if ((currentEffect & DND.FEEDBACK_INSERT_AFTER) != 0 ||
- (currentEffect & DND.FEEDBACK_INSERT_BEFORE) != 0) {
- tree.setInsertMark(null, false);
- }
- if ((currentEffect & DND.FEEDBACK_SELECT) != 0) {
- setDropSelection(null);
- }
-}
-private void setDropSelection (TreeItem item) {
-// if (item == dropSelection) return;
-// if (dropSelection != null) tree.deselectAll();
-// dropSelection = item;
-// if (dropSelection != null) tree.setSelection(new TreeItem[]{dropSelection});
-
- int hNewItem = 0;
- if (item != null) hNewItem = item.handle;
- OS.SendMessage (tree.handle, OS.TVM_SELECTITEM, OS.TVIS_DROPHILITED, hNewItem);
-}
-private void scrollHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_SCROLL) == 0) {
- scrollBeginTime = 0;
- scrollItem = null;
- return;
- }
- if (scrollItem == item && scrollBeginTime != 0) {
- if (System.currentTimeMillis() >= scrollBeginTime) {
- scroll(item, x, y);
- scrollBeginTime = 0;
- scrollItem = null;
- }
- return;
- }
- scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS;
- scrollItem = item;
-}
-private void scroll(TreeItem item, int x, int y) {
- if (item == null) return;
- Point coordinates = new Point(x, y);
- coordinates = tree.toControl(coordinates);
- Rectangle area = tree.getClientArea();
- TreeItem showItem = null;
- if (coordinates.y - area.y < SCROLL_WIDTH) {
- showItem = getPreviousVisibleItem(item);
- } else if ((area.y + area.height - coordinates.y) < SCROLL_WIDTH) {
- showItem = getNextVisibleItem(item, true);
- }
- if (showItem != null) {
- tree.showItem(showItem);
- }
-}
-private void expandHover (int effect, TreeItem item, int x, int y) {
- if ((effect & DND.FEEDBACK_EXPAND) == 0) {
- expandBeginTime = 0;
- expandItem = null;
- return;
- }
- if (expandItem == item && expandBeginTime != 0) {
- if (System.currentTimeMillis() >= expandBeginTime) {
- expand(item, x, y);
- expandBeginTime = 0;
- expandItem = null;
- }
- return;
- }
- expandBeginTime = System.currentTimeMillis() + EXPAND_HYSTERESIS;
- expandItem = item;
-}
-private void expand(TreeItem item, int x, int y) {
- if (item == null) return;
- if (item.getExpanded()) return;
- Event event = new Event();
- event.x = x;
- event.y = y;
- event.item = item;
- event.time = (int) System.currentTimeMillis();
- tree.notifyListeners(SWT.Expand, event);
- if (item.isDisposed()) return;
- item.setExpanded(true);
-}
-private TreeItem getNextVisibleItem(TreeItem item, boolean includeChildren) {
- // look down
- // neccesary on the first pass only
- if (includeChildren && item.getItemCount() > 0 && item.getExpanded()) {
- return item.getItems()[0];
- }
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = 0; i < peers.length - 1; i++) {
- if (peers[i] == item) return peers[i + 1];
- }
- // look up
- if (parent != null) return getNextVisibleItem(parent, false);
- return null;
-}
-private TreeItem getPreviousVisibleItem(TreeItem item) {
- // look sideways
- TreeItem parent = item.getParentItem();
- TreeItem[] peers = (parent != null) ? parent.getItems() : tree.getItems();
- for (int i = peers.length - 1; i > 0; i--) {
- if (peers[i] == item) {
- TreeItem peer = peers[i-1];
- if (!peer.getExpanded() || peer.getItemCount() == 0) return peer;
- TreeItem[] peerItems = peer.getItems();
- return peerItems[peerItems.length - 1];
- }
- }
- // look up
- return parent;
-}
-
-}

Back to the top