IDEA-148849 Windowed toolwindows do not preserve size on restart

This commit is contained in:
Vassiliy.Kudryashov
2016-03-31 19:19:19 +03:00
parent 976f1648d8
commit f8942c889b
@@ -2221,8 +2221,7 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
Window frame = myWindowedDecorator.getFrame();
if (!frame.isShowing()) return;
Rectangle bounds = frame.getBounds();
bounds.setLocation(frame.getLocationOnScreen());
Rectangle bounds = getRootBounds((JFrame)frame);
info.setFloatingBounds(bounds);
}
@@ -2243,6 +2242,14 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
}
}
@NotNull
private static Rectangle getRootBounds(JFrame frame) {
JRootPane rootPane = frame.getRootPane();
Rectangle bounds = rootPane.getBounds();
bounds.setLocation(frame.getX() + rootPane.getX(), frame.getY() + rootPane.getY());
return bounds;
}
private final class EditorComponentFocusWatcher extends FocusWatcher {
@Override
protected void focusedComponentChanged(final Component component, final AWTEvent cause) {
@@ -2383,6 +2390,12 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
info.setFloatingBounds(owner.getBounds());
}
}
else if (info.isWindowed()) {
WindowedDecorator decorator = getWindowedDecorator(info.getId());
Window frame = decorator != null ? decorator.getFrame() : null;
if (frame == null || !frame.isShowing()) return;
info.setFloatingBounds(getRootBounds((JFrame)frame));
}
else { // docked and sliding windows
ToolWindowAnchor anchor = info.getAnchor();
if (source.getParent() instanceof Splitter) {