void (@NotNull final Project project, @NotNull List<ShelvedChange> changes) { final UndoManagerImpl undoManager = (UndoManagerImpl)UndoManager.getInstance(project); if (undoManager != null && !changes.isEmpty()) { ContainerUtil.process(changes, change -> { final VirtualFile vfUnderProject = VfsUtil.findFileByIoFile(new File(project.getBasePath(), change.getAfterPath()), false); if (vfUnderProject != null) { final DocumentReference documentReference = DocumentReferenceManager.getInstance().create(vfUnderProject); undoManager.nonundoableActionPerformed(documentReference, false); undoManager.invalidateActionsFor(documentReference); } return true; }); } }