From 8bb19cb5e5e3c72660e1208bbb2fe5ba93bf7e03 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 27 Aug 2008 13:22:07 +0400 Subject: [PATCH] don't show drop target highlight outside of visible area (IDEADEV-29582) --- .../openapi/vcs/changes/ui/ChangesListView.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java b/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java index e27252bf46..7823b68a92 100644 --- a/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java +++ b/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesListView.java @@ -461,8 +461,9 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } final Rectangle tableCellRect = getPathBounds(new TreePath(dropNode.getPath())); - - aEvent.setHighlighting(new RelativeRectangle(ChangesListView.this, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE); + if (fitsInBounds(tableCellRect)) { + aEvent.setHighlighting(new RelativeRectangle(ChangesListView.this, tableCellRect), DnDEvent.DropTargetHighlightingType.RECTANGLE); + } aEvent.setDropPossible(true, null); dragBean.setTargetNode(dropNode); @@ -488,6 +489,18 @@ public class ChangesListView extends Tree implements TypeSafeDataProvider, Advan } } + private boolean fitsInBounds(final Rectangle rect) { + final Container container = getParent(); + if (container instanceof JViewport) { + final Container scrollPane = container.getParent(); + if (scrollPane instanceof JScrollPane) { + final Rectangle rectangle = SwingUtilities.convertRectangle(this, rect, scrollPane.getParent()); + return scrollPane.getBounds().contains(rectangle); + } + } + return true; + } + private static class NodeToTextConvertor implements Convertor { public String convert(final TreePath path) { ChangesBrowserNode node = (ChangesBrowserNode)path.getLastPathComponent(); -- 2.11.4.GIT