record (@NotNull ChangedVirtualDirectory directory, @NotNull PsiDirectory psiDirectory) { static @NotNull ModPsiUpdaterImpl.ChangedDirectoryInfo create(@NotNull PsiDirectory directory) { VirtualFile origDirectory = directory.getVirtualFile(); ChangedVirtualDirectory changedDirectory = new ChangedVirtualDirectory(origDirectory); return new ModPsiUpdaterImpl.ChangedDirectoryInfo(changedDirectory, PsiDirectoryFactory.getInstance(directory.getProject()) .createDirectory(changedDirectory)); } @NotNull Stream<ModCommand> createFileCommands(@NotNull Project project) { PsiManager manager = PsiManager.getInstance(project); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); return directory().getAddedChildren().values().stream() .map(vf -> { PsiFile psiFile = manager.findFile(vf); if (psiFile == null) return nop(); Document document = psiFile.getViewProvider().getDocument(); documentManager.commitDocument(document); documentManager.doPostponedOperationsAndUnblockDocument(document); return new ModCreateFile(new FutureVirtualFile(directory().getOriginalFile(), vf.getName(), vf.getFileType()), psiFile.getText()); }); } }