boolean (@NotNull VirtualFile file, @NotNull VirtualFile toDir) { if (!isMyVcs(toDir)) return false; startOperation(toDir); if (!isMyVcs(file)) return createItem(toDir, file.getName(), file.isDirectory(), true); File srcFile = getIOFile(file); File dstFile = new File(getIOFile(toDir), file.getName()); // save all documents here when !myMovedFiles.isEmpty() deletes these files from VFS // these leads to psi invalidation during refactoring inside write action // FileDocumentManager.getInstance().saveAllDocuments(); if (isPendingAdd(toDir)) { myMovedFiles.add(new MovedFileInfo(srcFile, dstFile)); return true; } else { myFilesToRefresh.add(file.getParent()); myFilesToRefresh.add(toDir); return doMove(srcFile, dstFile); } }