void () { ToolWindow defaultToolWindow = myDefaultDocToolWindow; if (defaultToolWindow == null && myLangToolWindows.isEmpty()) { return; } myToolWindow = null; myDefaultDocToolWindow = null; PropertiesComponent.getInstance().setValue(getShowInToolWindowProperty(), Boolean.FALSE.toString()); if (defaultToolWindow != null) { defaultToolWindow.remove(); Disposer.dispose(defaultToolWindow.getContentManager()); } for (Map.Entry<String, ToolWindow> entry : myLangToolWindows.entrySet()) { Language language = Language.findLanguageByID(entry.getKey()); if (language == null) continue; DocToolWindowManager toolWindowManager = DocToolWindowManager.LANGUAGE_MANAGER.forLanguage(language); if (toolWindowManager != null) { toolWindowManager.disposeToolWindow(entry.getValue(), this); } } myLangToolWindows.clear(); restartAutoUpdate(false); Component previouslyFocused = SoftReference.dereference(myFocusedBeforePopup); if (previouslyFocused != null && previouslyFocused.isShowing()) { UIUtil.runWhenFocused(previouslyFocused, () -> updateComponent(true)); IdeFocusManager.getInstance(myProject).requestFocus(previouslyFocused, true); } }