void (@NotNull final AnActionEvent e) { ConsoleCommunication consoleCommunication = consoleView.getExecuteActionHandler().getConsoleCommunication(); if (consoleCommunication.isExecuting() || consoleCommunication.isWaitingForInput()) { consoleView.print("^C", ProcessOutputTypes.SYSTEM); consoleCommunication.interrupt(); } else { DocumentEx document = consoleView.getConsoleEditor().getDocument(); if (document.getTextLength() != 0) { ApplicationManager.getApplication().runWriteAction(() -> CommandProcessor .getInstance() .runUndoTransparentAction(() -> document.deleteString(0, document .getLineEndOffset(document.getLineCount() - 1)))); } } }