void (final @NotNull AnActionEvent e) { Project project = getEventProject(e); if (project == null) { return; } ToolWindowManager windowManager = ToolWindowManager.getInstance(project); ToolWindowEventSource source; if (e.getInputEvent() instanceof KeyEvent) { source = ToolWindowEventSource.ActivateActionKeyboardShortcut; } else if (ActionPlaces.MAIN_MENU.equals(e.getPlace())) { source = ToolWindowEventSource.ActivateActionMenu; } else if (ActionPlaces.ACTION_SEARCH.equals(e.getPlace())) { source = ToolWindowEventSource.ActivateActionGotoAction; } else { source = ToolWindowEventSource.ActivateActionOther; } if (windowManager.isEditorComponentActive() || !myToolWindowId.equals(windowManager.getActiveToolWindowId())) { ToolWindow toolWindow = windowManager.getToolWindow(myToolWindowId); if (toolWindow != null) { if (hasEmptyState(project) && !toolWindow.isAvailable()) { toolWindow.setAvailable(true); } if (windowManager instanceof ToolWindowManagerImpl) { ((ToolWindowManagerImpl)windowManager).activateToolWindow(myToolWindowId, null, true, source); } else { toolWindow.activate(null); } } else if (hasEmptyState(project)) { createEmptyState(project); } } else if (windowManager instanceof ToolWindowManagerImpl) { ((ToolWindowManagerImpl)windowManager).hideToolWindow(myToolWindowId, false, true, false, source); } else { ToolWindow toolWindow = windowManager.getToolWindow(myToolWindowId); if (toolWindow != null) { toolWindow.hide(null); } } }