ToolWindowManagerListener () { return new ToolWindowManagerListener() { private final AtomicBoolean orientation = new AtomicBoolean(); private final AtomicBoolean visibility = new AtomicBoolean(true); @Override public void stateChanged(@NotNull ToolWindowManager manager) { ToolWindow window = manager.getToolWindow(ID); if (window == null || window.isDisposed()) return; boolean vertical = !window.getAnchor().isHorizontal(); if (vertical != orientation.getAndSet(vertical)) { for (Content content : window.getContentManager().getContents()) { var problemsViewTab = get(ProblemsViewTab.class, content); if (problemsViewTab != null) problemsViewTab.orientationChangedTo(vertical); } } boolean visible = window.isVisible(); if (visible != visibility.getAndSet(visible)) { Content selectedContent = window.getContentManager().getSelectedContent(); if (selectedContent != null) { visibilityChanged(visible, selectedContent); } } } }; }