diff options
author | Duong Nguyen <dnguyen> | 2008-01-31 00:16:52 +0000 |
---|---|---|
committer | Duong Nguyen <dnguyen> | 2008-01-31 00:16:52 +0000 |
commit | c3e877f8f7f86d0622d844511bee89e75388f2a5 (patch) | |
tree | 3e029c9db010abdb846e307733a4e6fce004d2ee | |
parent | d3ab70598558239dfbba5286fff86a903ec7ab74 (diff) | |
download | eclipse.platform.swt-c3e877f8f7f86d0622d844511bee89e75388f2a5.tar.gz eclipse.platform.swt-c3e877f8f7f86d0622d844511bee89e75388f2a5.tar.xz eclipse.platform.swt-c3e877f8f7f86d0622d844511bee89e75388f2a5.zip |
Bug 215388 - Add API to make the DropTarget more open
10 files changed, 28 insertions, 36 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java index f4f11bdf8c..cd00d4444d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DragSource.java @@ -105,7 +105,6 @@ public class DragSource extends Widget { DragSourceEffect dragEffect; static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ static Callback DragSendDataProc; static { @@ -146,10 +145,10 @@ public class DragSource extends Widget { public DragSource(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DRAGSOURCEID) != null) { + if (control.getData(DND.DRAG_SOURCE_KEY) != null) { DND.error(DND.ERROR_CANNOT_INIT_DRAG); } - control.setData(DRAGSOURCEID, this); + control.setData(DND.DRAG_SOURCE_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -201,7 +200,7 @@ static DragSource FindDragSource(int dragSendRefCon, int theDrag) { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(dragSendRefCon); if (widget == null) return null; - return (DragSource)widget.getData(DRAGSOURCEID); + return (DragSource)widget.getData(DND.DRAG_SOURCE_KEY); } /** @@ -430,7 +429,7 @@ void onDispose() { control.removeListener(SWT.DragDetect, controlListener); } controlListener = null; - control.setData(DRAGSOURCEID, null); + control.setData(DND.DRAG_SOURCE_KEY, null); control = null; transferAgents = null; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java index 0ea390c23d..24918055dd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/DropTarget.java @@ -93,7 +93,6 @@ public class DropTarget extends Widget { static DropTarget CurrentDropTarget = null; static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ - static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ static final int DRAGOVER_HYSTERESIS = 50; static Callback DragTrackingHandler; @@ -147,10 +146,10 @@ public DropTarget(Control control, int style) { if (DragTrackingHandler == null || DragTrackingHandler == null) { DND.error(DND.ERROR_CANNOT_INIT_DROP); } - if (control.getData(DROPTARGETID) != null) { + if (control.getData(DND.DROP_TARGET_KEY) != null) { DND.error(DND.ERROR_CANNOT_INIT_DROP); } - control.setData(DROPTARGETID, this); + control.setData(DND.DROP_TARGET_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -274,7 +273,7 @@ static DropTarget FindDropTarget(int theWindow, int theDrag) { if (!OS.IsControlEnabled(theControl[0])) return null; Widget widget = display.findWidget(theControl[0]); if (widget == null) return null; - return (DropTarget)widget.getData(DROPTARGETID); + return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** * Adds the listener to the collection of listeners who will @@ -559,7 +558,7 @@ void onDispose () { if (controlListener != null) control.removeListener(SWT.Dispose, controlListener); controlListener = null; - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); transferAgents = null; control = null; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TableDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TableDropTargetEffect.java index fc7c58b4a2..1f8f804902 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TableDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TableDropTargetEffect.java @@ -72,7 +72,7 @@ public class TableDropTargetEffect extends DropTargetEffect { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(theControl); if (widget == null) return null; - return (DropTarget)widget.getData(DropTarget.DROPTARGETID); + return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java index 0dc2931a30..400df25b27 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/carbon/org/eclipse/swt/dnd/TreeDropTargetEffect.java @@ -90,7 +90,7 @@ public class TreeDropTargetEffect extends DropTargetEffect { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(theControl); if (widget == null) return null; - return (DropTarget)widget.getData(DropTarget.DROPTARGETID); + return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DragSource.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DragSource.java index fe2abdc5c2..70f4361487 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DragSource.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DragSource.java @@ -99,7 +99,6 @@ public class DragSource extends Widget { private DragSourceEffect dragEffect; private static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - private static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ /** * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>. @@ -133,9 +132,9 @@ public class DragSource extends Widget { public DragSource(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DRAGSOURCEID) != null) + if (control.getData(DND.DRAG_SOURCE_KEY) != null) DND.error(DND.ERROR_CANNOT_INIT_DRAG); - control.setData(DRAGSOURCEID, this); + control.setData(DND.DRAG_SOURCE_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -260,7 +259,7 @@ private void onDispose() { control.removeListener(SWT.DragDetect, controlListener); } controlListener = null; - control.setData(DRAGSOURCEID, null); + control.setData(DND.DRAG_SOURCE_KEY, null); control = null; transferAgents = null; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DropTarget.java index 24816f2cb4..9599b1ef2e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/emulated/org/eclipse/swt/dnd/DropTarget.java @@ -74,7 +74,6 @@ public class DropTarget extends Widget { DropTargetEffect dropEffect; static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ - static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ /** * Creates a new <code>DropTarget</code> to allow data to be dropped on the specified @@ -110,9 +109,9 @@ public class DropTarget extends Widget { public DropTarget(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DROPTARGETID) != null) + if (control.getData(DND.DROP_TARGET_KEY) != null) DND.error(DND.ERROR_CANNOT_INIT_DROP); - control.setData(DROPTARGETID, this); + control.setData(DND.DROP_TARGET_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -234,7 +233,7 @@ void onDispose () { if (controlListener != null) control.removeListener(SWT.Dispose, controlListener); controlListener = null; - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); transferAgents = null; control = null; } 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 index fe2abdc5c2..70f4361487 100755 --- 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 @@ -99,7 +99,6 @@ public class DragSource extends Widget { private DragSourceEffect dragEffect; private static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - private static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ /** * Creates a new <code>DragSource</code> to handle dragging from the specified <code>Control</code>. @@ -133,9 +132,9 @@ public class DragSource extends Widget { public DragSource(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DRAGSOURCEID) != null) + if (control.getData(DND.DRAG_SOURCE_KEY) != null) DND.error(DND.ERROR_CANNOT_INIT_DRAG); - control.setData(DRAGSOURCEID, this); + control.setData(DND.DRAG_SOURCE_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -260,7 +259,7 @@ private void onDispose() { control.removeListener(SWT.DragDetect, controlListener); } controlListener = null; - control.setData(DRAGSOURCEID, null); + control.setData(DND.DRAG_SOURCE_KEY, null); control = null; transferAgents = null; } 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 index 24816f2cb4..9599b1ef2e 100755 --- 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 @@ -74,7 +74,6 @@ public class DropTarget extends Widget { DropTargetEffect dropEffect; static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ - static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ /** * Creates a new <code>DropTarget</code> to allow data to be dropped on the specified @@ -110,9 +109,9 @@ public class DropTarget extends Widget { public DropTarget(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DROPTARGETID) != null) + if (control.getData(DND.DROP_TARGET_KEY) != null) DND.error(DND.ERROR_CANNOT_INIT_DROP); - control.setData(DROPTARGETID, this); + control.setData(DND.DROP_TARGET_KEY, this); controlListener = new Listener () { public void handleEvent (Event event) { @@ -234,7 +233,7 @@ void onDispose () { if (controlListener != null) control.removeListener(SWT.Dispose, controlListener); controlListener = null; - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); transferAgents = null; control = null; } 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 index 4716041598..dfbd6e03c2 100755 --- 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 @@ -113,7 +113,6 @@ public class DragSource extends Widget { int dataEffect = DND.DROP_NONE; static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ static final int CFSTR_PERFORMEDDROPEFFECT = Transfer.registerType("Performed DropEffect"); //$NON-NLS-1$ static final TCHAR WindowClass = new TCHAR (0, "#32770", true); @@ -149,10 +148,10 @@ public class DragSource extends Widget { public DragSource(Control control, int style) { super(control, checkStyle(style)); this.control = control; - if (control.getData(DRAGSOURCEID) != null) { + if (control.getData(DND.DRAG_SOURCE_KEY) != null) { DND.error(DND.ERROR_CANNOT_INIT_DRAG); } - control.setData(DRAGSOURCEID, this); + control.setData(DND.DRAG_SOURCE_KEY, this); createCOMInterfaces(); this.AddRef(); @@ -530,7 +529,7 @@ private void onDispose() { control.removeListener(SWT.DragDetect, controlListener); } controlListener = null; - control.setData(DRAGSOURCEID, null); + control.setData(DND.DRAG_SOURCE_KEY, null); control = null; transferAgents = null; } 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 index 2a01c876f2..691f292df7 100755 --- 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 @@ -91,7 +91,6 @@ public class DropTarget extends Widget { int refCount; static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ - static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ /** * Creates a new <code>DropTarget</code> to allow data to be dropped on the specified @@ -127,10 +126,10 @@ public class DropTarget extends Widget { public DropTarget(Control control, int style) { super (control, checkStyle(style)); this.control = control; - if (control.getData(DROPTARGETID) != null) { + if (control.getData(DND.DROP_TARGET_KEY) != null) { DND.error(DND.ERROR_CANNOT_INIT_DROP); } - control.setData(DROPTARGETID, this); + control.setData(DND.DROP_TARGET_KEY, this); createCOMInterfaces(); this.AddRef(); @@ -516,7 +515,7 @@ void onDispose () { if (controlListener != null) control.removeListener(SWT.Dispose, controlListener); controlListener = null; - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); transferAgents = null; control = null; |