void (@NotNull AnActionEvent e) { RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(e.getDataContext()); boolean isConsoleSelected = descriptor != null && isConsoleSelected(descriptor); ProcessHandler handler = descriptor != null ? descriptor.getProcessHandler() : null; e.getPresentation().setEnabledAndVisible(isConsoleSelected && handler != null && !handler.isProcessTerminated()); }