void () { final VirtualFile[] f1 = new VirtualFile[1]; final VirtualFile[] f2 = new VirtualFile[1]; final VirtualFile[] f3 = new VirtualFile[1]; executeCommand(() -> { f1[0] = createChildData(myRoot, "f1.java"); f2[0] = createChildData(myRoot, "f2.java"); f3[0] = createChildData(myRoot, "f3.java"); }); for (VirtualFile each : FileEditorManager.getInstance(myProject).getOpenFiles()) { FileEditorManager.getInstance(myProject).closeFile(each); } executeCommand(() -> { setDocumentText(f1[0], "f1"); setDocumentText(f2[0], "f2"); }); executeCommand(() -> setDocumentText(f3[0], "f3")); undo(getEditor(f3[0])); undo(null); assertEquals("", getDocumentText(f1[0])); assertEquals("", getDocumentText(f3[0])); assertRedoIsAvailable(null); assertRedoIsAvailable(getEditor(f1[0])); assertRedoIsAvailable(getEditor(f2[0])); assertRedoIsAvailable(getEditor(f3[0])); for (VirtualFile each : FileEditorManager.getInstance(myProject).getOpenFiles()) { FileEditorManager.getInstance(myProject).closeFile(each); } executeCommand(() -> setDocumentText(f1[0], "ff1")); assertRedoNotAvailable(null); assertRedoNotAvailable(getEditor(f1[0])); assertRedoNotAvailable(getEditor(f2[0])); assertRedoIsAvailable(getEditor(f3[0])); }