From 7e9b02c62c046394f065fd0aff2ed1c440da7570 Mon Sep 17 00:00:00 2001 From: Vassiliy Kudryashov Date: Wed, 11 Jul 2012 15:48:25 +0400 Subject: [PATCH] IDEA-86947 Run configuration list should support drag and drop to reorder the run configurations --- .../platform-api/src/com/intellij/ui/RowsDnDSupport.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java index 1a8438cc511e..a29c73739737 100644 --- a/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java +++ b/platform/platform-api/src/com/intellij/ui/RowsDnDSupport.java @@ -47,6 +47,7 @@ public class RowsDnDSupport { } private static void installImpl(@NotNull final JComponent component, @NotNull final EditableModel model) { + component.setTransferHandler(new TransferHandler(null)); DnDSupport.createBuilder(component) .setBeanProvider(new Function() { @Override @@ -72,8 +73,10 @@ public class RowsDnDSupport { event.setHighlighting(rectangle, 2); } else { - event.setDropPossible(false); + if (oldIndex != newIndex) // Drag&Drop always starts with new==old and we shouldn't display 'rejecting' cursor in this case + event.setDropPossible(false, ""); event.hideHighlighter(); + return true; } return false; } @@ -122,7 +125,7 @@ public class RowsDnDSupport { } else if (component instanceof JList) { return ((JList)component).locationToIndex(point); } else if (component instanceof JTree) { - return ((JTree)component).getRowForLocation(point.x, point.y); + return ((JTree)component).getClosestRowForLocation(point.x, point.y); } else { throw new IllegalArgumentException("Unsupported component: " + component); }