diff options
author | Scott Kovatch <skovatch> | 2011-02-01 00:35:48 +0000 |
---|---|---|
committer | Scott Kovatch <skovatch> | 2011-02-01 00:35:48 +0000 |
commit | f0d4660babe52f05f080afe690712548b178efc1 (patch) | |
tree | 3c62210a0ada6d0a92dfbad9a0fd58ce9363c78b /bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa | |
parent | 97dcb864bee7f05899573074b8ef42176325ee45 (diff) | |
download | eclipse.platform.swt-f0d4660babe52f05f080afe690712548b178efc1.tar.gz eclipse.platform.swt-f0d4660babe52f05f080afe690712548b178efc1.tar.xz eclipse.platform.swt-f0d4660babe52f05f080afe690712548b178efc1.zip |
335172 - set the drop feedback on the row we computed feedback for.
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java index 36eb935417..4302109771 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/cocoa/org/eclipse/swt/dnd/DropTarget.java @@ -960,18 +960,26 @@ boolean tableView_acceptDrop_row_dropOperation(int /*long*/ id, int /*long*/ sel int tableView_validateDrop_proposedRow_proposedDropOperation(int /*long*/ id, int /*long*/ sel, int /*long*/ tableView, int /*long*/ info, int /*long*/ row, int /*long*/ operation) { //TODO stop scrolling and expansion when app does not set FEEDBACK_SCROLL and/or FEEDBACK_EXPAND NSTableView widget = new NSTableView(tableView); - if (0 <= row && row < widget.numberOfRows()) { + NSObject sender = new NSObject(info); + NSPoint pt = sender.draggingLocation(); + pt = widget.convertPoint_fromView_(pt, null); + Table table = (Table)getControl(); + TableItem childItem = table.getItem(new Point((int)pt.x, (int)pt.y)); + int rowUnderMouse = -1; + if (childItem != null) rowUnderMouse = table.indexOf(childItem); + + if (0 <= rowUnderMouse && rowUnderMouse < widget.numberOfRows()) { if (feedback == 0) { widget.setDropRow(-1, OS.NSTableViewDropOn); } else { if ((feedback & DND.FEEDBACK_SELECT) != 0) { - widget.setDropRow(row, OS.NSTableViewDropOn); + widget.setDropRow(rowUnderMouse, OS.NSTableViewDropOn); } else { if ((feedback & DND.FEEDBACK_INSERT_AFTER) != 0) { - widget.setDropRow(row + 1, OS.NSTableViewDropAbove); + widget.setDropRow(rowUnderMouse + 1, OS.NSTableViewDropAbove); } if ((feedback & DND.FEEDBACK_INSERT_BEFORE) != 0) { - widget.setDropRow(row, OS.NSTableViewDropAbove); + widget.setDropRow(rowUnderMouse, OS.NSTableViewDropAbove); } } } |