From b0f499740a3164bede9e4ab2082451675c4b5660 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 7 Feb 2014 19:27:17 +0400 Subject: [PATCH] IDEA-91883 Edit breakpoint dialog: cannot click on combo if it expands out of the popup border --- .../src/com/intellij/ui/BalloonImpl.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java index 69297d1fe14e..5f43f8cb798d 100644 --- a/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/BalloonImpl.java @@ -197,12 +197,28 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui { if (!cmp.isShowing()) return true; if (cmp == myCloseRec) return true; - if (SwingUtilities.isDescendingFrom(cmp, myComp) || cmp == myComp) return true; + if (isDescendingFrom(cmp, myComp) || cmp == myComp) return true; if (myComp == null || !myComp.isShowing()) return false; Rectangle rectangleOnScreen = new Rectangle(myComp.getLocationOnScreen(), myComp.getSize()); return rectangleOnScreen.contains(target.getScreenPoint()); } + private static boolean isDescendingFrom(@Nullable Component a, @NotNull Component b) { + while (a != null) { + if (a == b) { + return true; + } + + if (a instanceof JPopupMenu) { + a = ((JPopupMenu)a).getInvoker(); + } + else { + a = a.getParent(); + } + } + return false; + } + public boolean isMovingForward(RelativePoint target) { try { if (myComp == null || !myComp.isShowing()) return false;