void (@NotNull AnActionEvent event) { Presentation presentation = event.getPresentation(); Project project = event.getProject(); if (project == null) { presentation.setEnabled(false); return; } ToolWindowManager manager = ToolWindowManager.getInstance(project); String id = manager.getLastActiveToolWindowId(); presentation.setEnabled(id != null && manager.getToolWindow(id).isAvailable()); }