diff options
author | Duong Nguyen <dnguyen> | 2008-01-30 23:46:43 +0000 |
---|---|---|
committer | Duong Nguyen <dnguyen> | 2008-01-30 23:46:43 +0000 |
commit | 7a922c7d2b814bfd5d82c3bf89128d892b6c828f (patch) | |
tree | 0831e2ab19efec4d3cd5d0279573caa3d441d65d | |
parent | 24d61c197f67bbff18fc799caebdd780f93aa55e (diff) | |
download | eclipse.platform.swt-7a922c7d2b814bfd5d82c3bf89128d892b6c828f.tar.gz eclipse.platform.swt-7a922c7d2b814bfd5d82c3bf89128d892b6c828f.tar.xz eclipse.platform.swt-7a922c7d2b814bfd5d82c3bf89128d892b6c828f.zip |
Bug 215388 - Add API to make the DropTarget more open
4 files changed, 15 insertions, 19 deletions
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 index cab6689e43..d536101f94 100644 --- 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 @@ -107,7 +107,6 @@ public class DragSource extends Widget { boolean moveData = false; static final String DEFAULT_DRAG_SOURCE_EFFECT = "DEFAULT_DRAG_SOURCE_EFFECT"; //$NON-NLS-1$ - static final String DRAGSOURCEID = "DragSource"; //$NON-NLS-1$ static Callback DragGetData; static Callback DragEnd; @@ -156,10 +155,10 @@ public DragSource(Control control, int style) { if (DragGetData == null || DragEnd == null || DragDataDelete == null) { DND.error(DND.ERROR_CANNOT_INIT_DRAG); } - 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); OS.g_signal_connect(control.handle, OS.drag_data_get, DragGetData.getAddress(), 0); OS.g_signal_connect(control.handle, OS.drag_end, DragEnd.getAddress(), 0); @@ -229,7 +228,7 @@ static DragSource FindDragSource(int /*long*/ handle) { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(handle); if (widget == null) return null; - return (DragSource)widget.getData(DRAGSOURCEID); + return (DragSource)widget.getData(DND.DRAG_SOURCE_KEY); } /** @@ -416,7 +415,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/gtk/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/DropTarget.java index 07cbe6bf5c..9cca32f3ab 100644 --- 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 @@ -93,7 +93,6 @@ public class DropTarget extends Widget { int drag_drop_handler; 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 Drag_Motion; @@ -149,10 +148,10 @@ public DropTarget(Control control, int style) { if (Drag_Motion == null || Drag_Leave == null || Drag_Data_Received == null || Drag_Drop == 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); drag_motion_handler = OS.g_signal_connect(control.handle, OS.drag_motion, Drag_Motion.getAddress(), 0); drag_leave_handler = OS.g_signal_connect(control.handle, OS.drag_leave, Drag_Leave.getAddress(), 0); @@ -271,7 +270,7 @@ static DropTarget FindDropTarget(int /*long*/ handle) { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(handle); if (widget == null) return null; - return (DropTarget)widget.getData(DROPTARGETID); + return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); } /** @@ -549,7 +548,7 @@ void onDispose(){ transferAgents = null; if (controlListener != null) control.removeListener(SWT.Dispose, controlListener); - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); control = null; controlListener = null; } 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 index 975dc84cfa..216f0b6a1a 100755 --- 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 @@ -101,7 +101,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 ConvertProc; static Callback DragDropFinish; @@ -152,9 +151,9 @@ public DragSource(Control control, int style) { if (ConvertProc == null || DragDropFinish == null || DropFinish == null) DND.error(DND.ERROR_CANNOT_INIT_DRAG); 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) { @@ -495,7 +494,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/motif/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/motif/org/eclipse/swt/dnd/DropTarget.java index 91bea41962..cff8fbf7d2 100755 --- 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 @@ -102,7 +102,6 @@ public class DropTarget extends Widget { static final String DEFAULT_DROP_TARGET_EFFECT = "DEFAULT_DROP_TARGET_EFFECT"; //$NON-NLS-1$ static int DELETE_TYPE = Transfer.registerType("DELETE\0"); //$NON-NLS-1$ static int NULL_TYPE = Transfer.registerType("NULL\0"); //$NON-NLS-1$ - static final String DROPTARGETID = "DropTarget"; //$NON-NLS-1$ static final int DRAGOVER_HYSTERESIS = 50; static Callback DropProc; @@ -155,10 +154,10 @@ public DropTarget(Control control, int style) { if (DropProc == null || DragProc == null || TransferProc == 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) { @@ -301,7 +300,7 @@ static DropTarget FindDropTarget(int handle) { if (display == null || display.isDisposed()) return null; Widget widget = display.findWidget(handle); if (widget == null) return null; - return (DropTarget)widget.getData(DROPTARGETID); + return (DropTarget)widget.getData(DND.DROP_TARGET_KEY); } static int TransferProcCallback(int widget, int client_data, int pSelection, int pType, int pValue, int pLength, int pFormat) { @@ -554,7 +553,7 @@ void onDispose() { control.removeListener(SWT.Dispose, controlListener); } controlListener = null; - control.setData(DROPTARGETID, null); + control.setData(DND.DROP_TARGET_KEY, null); control = null; transferAgents = null; } |