void (Content content) { invokeLaterIfNeeded(() -> { ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(TOOL_WINDOW_ID); ContentManager contentManager = toolWindow == null ? null : toolWindow.getContentManager(); if (contentManager != null && !contentManager.isDisposed()) { contentManager.removeContent(content, true); } }); }