From 67a9842f67cb13e95384faf8e7fb9cfcf2aad40c Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 21 Nov 2019 20:25:39 +0100 Subject: [PATCH] cleanup GitOrigin-RevId: 3913cd6a971da5b6073ecdae9ab548757511c56e --- .../wm/impl/ToolWindowManagerImpl.java | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java index f6c05e97ce63..2cd25b9c9a06 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java @@ -1227,18 +1227,20 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis @Override public void setLayout(@NotNull DesktopLayout layout) { ApplicationManager.getApplication().assertIsDispatchThread(); + List commandList = new ArrayList<>(); // hide tool window that are invisible or its info is not presented in new layout - final List currentInfos = myLayout.getInfos(); - for (final WindowInfoImpl currentInfo : currentInfos) { - final WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); + List currentInfos = myLayout.getInfos(); + for (WindowInfoImpl currentInfo : currentInfos) { + WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); if (currentInfo.isVisible() && (info == null || !info.isVisible())) { deactivateToolWindowImpl(currentInfo, true, commandList); } } + // change anchor of tool windows - for (final WindowInfoImpl currentInfo : currentInfos) { - final WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); + for (WindowInfoImpl currentInfo : currentInfos) { + WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); if (info == null) { continue; } @@ -1246,8 +1248,9 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis setToolWindowAnchorImpl(currentInfo.getId(), info.getAnchor(), info.getOrder(), commandList); } } + // change types of tool windows - for (final WindowInfoImpl currentInfo : currentInfos) { + for (WindowInfoImpl currentInfo : currentInfos) { final WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); if (info == null) { continue; @@ -1256,17 +1259,19 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis setToolWindowTypeImpl(currentInfo.getId(), info.getType(), commandList); } } + // change other properties - for (final WindowInfoImpl currentInfo : currentInfos) { + for (WindowInfoImpl currentInfo : currentInfos) { final WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); if (info == null) { continue; } copyWindowOptions(info, commandList); } + // restore visibility - for (final WindowInfoImpl currentInfo : currentInfos) { - final WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); + for (WindowInfoImpl currentInfo : currentInfos) { + WindowInfoImpl info = layout.getInfo(Objects.requireNonNull(currentInfo.getId()), false); if (info == null) { continue; } @@ -1280,7 +1285,7 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis } @Override - public void invokeLater(@NotNull final Runnable runnable) { + public void invokeLater(@NotNull Runnable runnable) { List commandList = new ArrayList<>(); commandList.add(new InvokeLaterCmd(runnable, myCommandProcessor)); execute(commandList);