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 9070058af4a5..eab37f311eb2 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 @@ -838,8 +838,10 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis myActiveStack.remove(each, true); } - while (!mySideStack.isEmpty(info.getAnchor())) { - mySideStack.pop(info.getAnchor()); + if (isStackEnabled()) { + while (!mySideStack.isEmpty(info.getAnchor())) { + mySideStack.pop(info.getAnchor()); + } } for (WindowInfoImpl eachInfo : myLayout.getInfos()) { @@ -848,28 +850,30 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis } } } - else if (isStackEnabled()) { + else { // first of all we have to find tool window that was located at the same side and was hidden - WindowInfoImpl info2 = null; - while (!mySideStack.isEmpty(info.getAnchor())) { - final WindowInfoImpl storedInfo = mySideStack.pop(info.getAnchor()); - if (storedInfo.isSplit() != info.isSplit()) { - continue; - } + if (isStackEnabled()) { + WindowInfoImpl info2 = null; + while (!mySideStack.isEmpty(info.getAnchor())) { + final WindowInfoImpl storedInfo = mySideStack.pop(info.getAnchor()); + if (storedInfo.isSplit() != info.isSplit()) { + continue; + } - final WindowInfoImpl currentInfo = getRegisteredInfoOrLogError(Objects.requireNonNull(storedInfo.getId())); - // SideStack contains copies of real WindowInfos. It means that - // these stored infos can be invalid. The following loop removes invalid WindowInfos. - if (storedInfo.getAnchor() == currentInfo.getAnchor() && - storedInfo.getType() == currentInfo.getType() && - storedInfo.isAutoHide() == currentInfo.isAutoHide()) { - info2 = storedInfo; - break; + final WindowInfoImpl currentInfo = getRegisteredInfoOrLogError(Objects.requireNonNull(storedInfo.getId())); + // SideStack contains copies of real WindowInfos. It means that + // these stored infos can be invalid. The following loop removes invalid WindowInfos. + if (storedInfo.getAnchor() == currentInfo.getAnchor() && + storedInfo.getType() == currentInfo.getType() && + storedInfo.isAutoHide() == currentInfo.isAutoHide()) { + info2 = storedInfo; + break; + } + } + if (info2 != null) { + showToolWindowImpl(Objects.requireNonNull(info2.getId()), false, commandList); } - } - if (info2 != null) { - showToolWindowImpl(Objects.requireNonNull(info2.getId()), false, commandList); } // If we hide currently active tool window then we should activate the previous @@ -944,16 +948,19 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis } appendApplyWindowInfoCmd(info, commandsList); // store WindowInfo into the SideStack - if (info.isDocked() && !info.isAutoHide()) { - mySideStack.push(info); + if (isStackEnabled()) { + if (info.isDocked() && !info.isAutoHide()) { + mySideStack.push(info); + } } } } appendAddDecoratorCmd(decorator, toBeShownInfo, dirtyMode, commandsList); // Remove tool window from the SideStack. - - mySideStack.remove(id); + if (isStackEnabled()) { + mySideStack.remove(id); + } } if (!toBeShownInfo.isShowStripeButton()) { @@ -1130,7 +1137,9 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis // Save recent appearance of tool window myLayout.unregister(id); myActiveStack.remove(id, true); - mySideStack.remove(id); + if (isStackEnabled()) { + mySideStack.remove(id); + } appendRemoveButtonCmd(id, info, commandsList); appendApplyWindowInfoCmd(info, commandsList); @@ -1714,7 +1723,9 @@ public class ToolWindowManagerImpl extends ToolWindowManagerEx implements Persis @Override public void clearSideStack() { - mySideStack.clear(); + if (isStackEnabled()) { + mySideStack.clear(); + } } @Nullable diff --git a/platform/util/resources/misc/registry.properties b/platform/util/resources/misc/registry.properties index 68aea7158d99..5f9c20803938 100644 --- a/platform/util/resources/misc/registry.properties +++ b/platform/util/resources/misc/registry.properties @@ -710,7 +710,7 @@ idea.report.nullity.missing.in.generated.overriders.description=Whether "@NotNul ide.ignore.call.result.inspection.honor.inferred.pure=true ide.ignore.call.result.inspection.honor.inferred.pure.description=Whether inferred @Contract(pure=true) annotations should be taken into account in ''Result of method call ignored'' inspection -ide.enable.toolwindow.stack=true +ide.enable.toolwindow.stack=false ide.enable.toolwindow.stack.description=Remember which toolwindows were shown before the currently active one on the same side, and show them when the active one is hidden disable.toolwindow.overlay=true