void (final Editor editor, final @NotNull DataContext dataContext) { if (editor == null) return; if (editor.isDisposed()) { VirtualFile file = FileDocumentManager.getInstance().getFile(editor.getDocument()); LOG.error("Action " + this + " invoked on a disposed editor" + (file == null ? "" : " for file " + file)); return; } final EditorActionHandler handler = getHandler(); Runnable command = () -> handler.execute(editor, null, getProjectAwareDataContext(editor, dataContext)); if (!handler.executeInCommand(editor, dataContext)) { command.run(); return; } String commandName = getTemplatePresentation().getText(); if (commandName == null) commandName = ""; CommandProcessor.getInstance().executeCommand(editor.getProject(), command, commandName, handler.getCommandGroupId(editor), UndoConfirmationPolicy.DEFAULT, editor.getDocument()); }