void (EditorKey editorKey, Project project) { String actionID = editorKey.action; Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor != null) { ApplicationManager.getApplication().runWriteAction(Context.current().wrap(() -> { TraceUtil.runWithSpanThrows(PerformanceTestSpan.TRACER, DelayTypeCommand.SPAN_NAME, span -> { AnAction action = ActionManagerEx.getInstanceEx().getAction(actionID); AnActionEvent actionEvent = AnActionEvent.createFromAnAction(action, null, "", EditorUtils.createEditorContext(editor)); ActionUtil.performDumbAwareWithCallbacks(action, actionEvent, () -> { CommandProcessor.getInstance().executeCommand(project, () -> { action.actionPerformed(actionEvent); }, "", null, editor.getDocument()); }); span.addEvent("Typing " + actionID); }); })); } else { throw new IllegalStateException("Editor is not opened"); } }