Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/photon/org/eclipse/swt')
-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
11 files changed, 0 insertions, 1131 deletions
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
-}
-}

Back to the top