diff --git a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java index 715b703e2321..5844767aac87 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java +++ b/platform/platform-api/src/com/intellij/openapi/util/DimensionService.java @@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.wm.IdeFocusManager; +import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.WindowManager; import com.intellij.ui.ScreenUtil; import com.intellij.util.containers.hash.LinkedHashMap; @@ -252,15 +253,14 @@ public class DimensionService implements PersistentStateComponent { } JFrame frame = null; - if (project == null) { - final Component owner = IdeFocusManager.findInstance().getFocusOwner(); - if (owner != null) { - frame = UIUtil.getParentOfType(JFrame.class, owner); - } - if (frame == null) { - frame = WindowManager.getInstance().findVisibleFrame(); - } - } else { + final Component owner = IdeFocusManager.findInstance().getFocusOwner(); + if (owner != null) { + frame = UIUtil.getParentOfType(JFrame.class, owner); + } + if (frame == null) { + frame = WindowManager.getInstance().findVisibleFrame(); + } + if (project != null && (frame == null || (frame instanceof IdeFrame && project != ((IdeFrame)frame).getProject()))) { frame = WindowManager.getInstance().getFrame(project); } Rectangle screen = new Rectangle(0, 0, 0, 0); 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 7274d0930824..039868096f10 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -747,7 +747,7 @@ public class AbstractPopup implements JBPopup { Point xy = new Point(aScreenX, aScreenY); boolean adjustXY = true; - if (myDimensionServiceKey != null) { + if (myUseDimServiceForXYLocation && myDimensionServiceKey != null) { final Point storedLocation = DimensionService.getInstance().getLocation(myDimensionServiceKey, myProject); if (storedLocation != null) { xy = storedLocation;