void (@Nullable PsiElement element, @Nullable CompletableFuture<PsiElement> elementFuture, PsiElement originalElement) { assert myToolWindow == null; T component = createComponent(); ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject); ToolWindow toolWindow = toolWindowManager.getToolWindow(getToolwindowId()); if (toolWindow == null) { toolWindow = toolWindowManager .registerToolWindow(RegisterToolWindowTask.closable(getToolwindowId(), this::getToolwindowTitle, AllIcons.Toolwindows.Documentation, ToolWindowAnchor.RIGHT)); } else { toolWindow.setAvailable(true); } myToolWindow = toolWindow; toolWindow.setToHideOnEmptyContent(false); setToolwindowDefaultState(myToolWindow); ContentManager contentManager = toolWindow.getContentManager(); String displayName = element != null ? getTitle(element) : ""; contentManager.addContent(ContentFactory.getInstance().createContent(component, displayName, false)); contentManager.addContentManagerListener(new ContentManagerListener() { @Override public void contentRemoved(@NotNull ContentManagerEvent event) { restorePopupBehavior(); } }); installComponentActions(toolWindow, component); UiNotifyConnector.installOn(component, new Activatable() { @Override public void showNotify() { restartAutoUpdate(PropertiesComponent.getInstance().getBoolean(getAutoUpdateEnabledProperty(), getAutoUpdateDefault())); } @Override public void hideNotify() { restartAutoUpdate(false); } }); myToolWindow.show(null); PropertiesComponent.getInstance().setValue(getShowInToolWindowProperty(), Boolean.TRUE.toString()); restartAutoUpdate(PropertiesComponent.getInstance().getBoolean(getAutoUpdateEnabledProperty(), true)); if (element != null) { doUpdateComponent(element, originalElement, component, false); } else { //noinspection ConstantConditions doUpdateComponent(elementFuture, originalElement, component, false); } }