void (@NotNull AnActionEvent e) { e.getPresentation().setVisible(false); Editor editor = consoleView.getConsoleEditor(); if (LookupManager.getActiveLookup(editor) != null) { e.getPresentation().setEnabled(false); } int offset = editor.getCaretModel().getOffset(); Document document = editor.getDocument(); int lineStart = document.getLineStartOffset(document.getLineNumber(offset)); String textToCursor = document.getText(new TextRange(lineStart, offset)); e.getPresentation().setEnabled(!CharMatcher.whitespace().matchesAllOf(textToCursor)); }