diff options
Diffstat (limited to 'platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java')
-rw-r--r-- | platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index e50403abef45..a967245c9224 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -487,22 +487,24 @@ public class AbstractPopup implements JBPopup { if (dominantArea != null) { final Component focusedComponent = getWndManager().getFocusedComponent(myProject); - Window window = SwingUtilities.windowForComponent(focusedComponent); - JLayeredPane layeredPane; - if (window instanceof JFrame) { - layeredPane = ((JFrame)window).getLayeredPane(); - } - else if (window instanceof JDialog) { - layeredPane = ((JDialog)window).getLayeredPane(); - } - else if (window instanceof JWindow) { - layeredPane = ((JWindow)window).getLayeredPane(); - } - else { - throw new IllegalStateException("cannot find parent window: project=" + myProject + "; window=" + window); - } + if (focusedComponent != null) { + Window window = SwingUtilities.windowForComponent(focusedComponent); + JLayeredPane layeredPane; + if (window instanceof JFrame) { + layeredPane = ((JFrame)window).getLayeredPane(); + } + else if (window instanceof JDialog) { + layeredPane = ((JDialog)window).getLayeredPane(); + } + else if (window instanceof JWindow) { + layeredPane = ((JWindow)window).getLayeredPane(); + } + else { + throw new IllegalStateException("cannot find parent window: project=" + myProject + "; window=" + window); + } - return relativePointWithDominantRectangle(layeredPane, dominantArea); + return relativePointWithDominantRectangle(layeredPane, dominantArea); + } } return JBPopupFactory.getInstance().guessBestPopupLocation(dataContext); @@ -777,7 +779,9 @@ public class AbstractPopup implements JBPopup { Rectangle original = new Rectangle(targetBounds); if (myLocateWithinScreen) { - ScreenUtil.moveRectangleToFitTheScreen(targetBounds); + if (myMovable) { + ScreenUtil.moveRectangleToFitTheScreen(targetBounds); + } } if (myMouseOutCanceller != null) { |