void (@NotNull final AnActionEvent e) { e.getPresentation().setVisible(false); boolean enabled = false; EditorEx consoleEditor = consoleView.getConsoleEditor(); if (IJSwingUtilities.hasFocus(consoleEditor.getComponent())) { enabled = !consoleEditor.getSelectionModel().hasSelection(); } EditorEx historyViewer = consoleView.getHistoryViewer(); if (IJSwingUtilities.hasFocus(historyViewer.getComponent())) { enabled = !historyViewer.getSelectionModel().hasSelection(); } e.getPresentation().setEnabled(enabled); }