void () { String fileName = "f.txt"; String projectFileName = "proj.txt"; VirtualFile f = createChildData(myRoot, projectFileName); executeCommand(() -> { createChildData(myRoot, fileName); // Rider case, modify externally and refresh some file in a command File ioFile = new File(f.getPath()); FileUtil.writeToFile(ioFile, "content".getBytes(Charsets.UTF_8)); ioFile.setLastModified(f.getTimeStamp() + 2000); UndoUtil.setForceUndoFlag(f, true); f.refresh(false, true); }); assertGlobalUndoIsAvailable(); assertNotNull(myRoot.findChild(fileName)); globalUndo(); assertNull(myRoot.findChild(fileName)); }