IDEA-92343 File Structure popup appears on wrong monitor

This commit is contained in:
Sergey Malenkov
2014-10-22 18:24:49 +04:00
parent 34abbd85c0
commit 9bb274c269
2 changed files with 10 additions and 10 deletions
@@ -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<Element> {
}
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);
@@ -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;