diff --git a/platform/util/src/com/intellij/ui/awt/RelativePoint.java b/platform/util/src/com/intellij/ui/awt/RelativePoint.java index 0280e56408b1..dcc24baad4b5 100644 --- a/platform/util/src/com/intellij/ui/awt/RelativePoint.java +++ b/platform/util/src/com/intellij/ui/awt/RelativePoint.java @@ -40,9 +40,21 @@ public class RelativePoint { public RelativePoint(Point screenPoint) { Point p = new Point(screenPoint.x, screenPoint.y); - Frame c = JOptionPane.getRootFrame(); - SwingUtilities.convertPointFromScreen(p, c); - init(c, p); + Window[] windows = Frame.getWindows(); + Window targetWindow = null; + for (Window each : windows) { + if (each.isActive()) { + targetWindow = each; + break; + } + } + + if (targetWindow == null) { + targetWindow = JOptionPane.getRootFrame(); + } + + SwingUtilities.convertPointFromScreen(p, targetWindow); + init(targetWindow, p); } private void init(Component aComponent, Point aPointOnComponent) {