void () { final StartMarkAction[] compound = new StartMarkAction[1]; start(compound); try { myManager.setOverriddenEditorProvider(new CurrentEditorProvider() { @Override public FileEditor getCurrentEditor(@Nullable Project project) { return getFileEditor(getSecondEditor()); } }); typeInText(getSecondEditor(), "initial "); } finally { myManager.setOverriddenEditorProvider(null); } assertNotNull(compound); try { typeInText("text"); backspace(getFirstEditor()); CommandProcessor.getInstance().executeCommand(getProject(), () -> { typeInTextToAllDocuments("TT"); CommandProcessor.getInstance().markCurrentCommandAsGlobal(getProject()); }, "global command", null); } finally { finish(compound[0]); } checkEditorText("texTT"); checkEditorText("initial TT", getSecondEditor()); undo(getFirstEditor()); checkEditorText("initial ", getSecondEditor()); try { myManager.setOverriddenEditorProvider(new CurrentEditorProvider() { @Override public FileEditor getCurrentEditor(@Nullable Project project) { return getFileEditor(getSecondEditor()); } }); undo(getSecondEditor()); } finally { myManager.setOverriddenEditorProvider(null); } checkEditorText("", getSecondEditor()); assertUndoNotAvailable(getSecondEditor()); }