void (final @NotNull Editor editor, final char charTyped, final @NotNull DataContext dataContext) { CommandProcessorEx commandProcessorEx = (CommandProcessorEx)CommandProcessor.getInstance(); Project project = CommonDataKeys.PROJECT.getData(dataContext); if (myCurrentCommandToken != null) { throw new IllegalStateException("Unexpected reentrancy of DefaultRawTypedHandler"); } myCurrentCommandToken = commandProcessorEx.startCommand(project, "", editor.getDocument(), UndoConfirmationPolicy.DEFAULT); myInOuterCommand = myCurrentCommandToken == null; try { if (!EditorModificationUtil.requestWriting(editor)) { return; } ApplicationManager.getApplication().runWriteAction(new DocumentRunnable(editor.getDocument(), editor.getProject()) { @Override public void run() { Document doc = editor.getDocument(); doc.startGuardedBlockChecking(); try { myAction.getHandler().execute(editor, charTyped, dataContext); } catch (ReadOnlyFragmentModificationException e) { EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e); } finally { doc.stopGuardedBlockChecking(); } } }); } finally { if (!myInOuterCommand) { commandProcessorEx.finishCommand(myCurrentCommandToken, null); myCurrentCommandToken = null; } myInOuterCommand = false; } }