From 07a85d031dafdf0d62655af5ab0b5ac26121b3a8 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Wed, 18 Sep 2019 20:42:44 +0300 Subject: [PATCH] IDEA-218956: WindowStateServiceImpl.loadStateFor should return false if state does not exist GitOrigin-RevId: d90f463a5d59f9bef3f3ee6c2dd8b8a1b2dafcb2 --- .../openapi/util/WindowStateServiceImpl.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java index 76f09d8f9e9d..3e25aec2ef8f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/util/WindowStateServiceImpl.java @@ -102,31 +102,24 @@ abstract class WindowStateServiceImpl extends WindowStateService implements Pers @Override public boolean loadStateFor(Object object, @NotNull String key, @NotNull Component component) { - Point location = null; - Dimension size = null; - boolean maximized = false; WindowState state = getFor(object, key, WindowState.class); - if (state != null) { - location = state.myLocation; - size = state.mySize; - maximized = state.myMaximized; - } + if (state == null) return false; Frame frame = component instanceof Frame ? (Frame)component : null; if (frame != null && Frame.NORMAL != frame.getExtendedState()) { frame.setExtendedState(Frame.NORMAL); } Rectangle bounds = component.getBounds(); - if (location != null) { - bounds.setLocation(location); + if (state.myLocation != null) { + bounds.setLocation(state.myLocation); } - if (size != null) { - bounds.setSize(size); + if (state.mySize != null) { + bounds.setSize(state.mySize); } if (bounds.isEmpty()) { bounds.setSize(component.getPreferredSize()); } component.setBounds(bounds); - if (maximized && frame != null) { + if (frame != null && state.myMaximized) { frame.setExtendedState(Frame.MAXIMIZED_BOTH); } return true;