summaryrefslogtreecommitdiff
path: root/platform/platform-impl/src/com/intellij/ui/popup
diff options
context:
space:
mode:
Diffstat (limited to 'platform/platform-impl/src/com/intellij/ui/popup')
-rw-r--r--platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java36
-rw-r--r--platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java9
2 files changed, 22 insertions, 23 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) {
diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java b/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java
index 5d657487f6a5..1428ffc9b29d 100644
--- a/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java
+++ b/platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java
@@ -16,7 +16,7 @@
package com.intellij.ui.popup.list;
import com.intellij.icons.AllIcons;
-import com.intellij.openapi.ui.popup.ListItemDescriptor;
+import com.intellij.openapi.ui.popup.ListItemDescriptorAdapter;
import com.intellij.openapi.ui.popup.ListPopupStep;
import com.intellij.ui.ColorUtil;
import com.intellij.util.ui.UIUtil;
@@ -27,18 +27,13 @@ public class PopupListElementRenderer extends GroupedItemsListRenderer {
private final ListPopupImpl myPopup;
public PopupListElementRenderer(final ListPopupImpl aPopup) {
- super(new ListItemDescriptor() {
+ super(new ListItemDescriptorAdapter() {
@Override
public String getTextFor(Object value) {
return aPopup.getListStep().getTextFor(value);
}
@Override
- public String getTooltipFor(Object value) {
- return null;
- }
-
- @Override
public Icon getIconFor(Object value) {
return aPopup.getListStep().getIconFor(value);
}