void () { // This code is a copy-pasted behaviour of ModuleIndexableFilesIteratorImpl and SdkIndexableFilesIteratorImpl. // Since they are planned to become obsolete next release, and API to iterate any indexable directory/file would be provided, // this dirty solution is good enough if (myIterateAsContent) { ModuleFileIndex index = ReadAction.compute(() -> { if (myProject.isDisposed() || !myRoot.isValid()) return null; Module module = ProjectFileIndex.getInstance(myProject).getModuleForFile(myRoot, false); if (module == null) return null; return ModuleRootManager.getInstance(module).getFileIndex(); }); if (index == null) return; final PushedFilePropertiesUpdater propertiesUpdater = PushedFilePropertiesUpdater.getInstance(myProject); index.iterateContentUnderDirectory(myRoot, (ContentIteratorEx)file -> { if (visitFileToPush(file, propertiesUpdater)) { return TreeNodeProcessingResult.CONTINUE; } return TreeNodeProcessingResult.SKIP_CHILDREN; }); return; } if (myProject.isDisposed() || !ReadAction.compute(() -> myRoot.isValid())) return; final PushedFilePropertiesUpdater propertiesUpdater = PushedFilePropertiesUpdater.getInstance(myProject); ProjectFileIndex projectFileIndex = ReadAction.compute(() -> { if (myProject.isDisposed()) return null; return ProjectFileIndex.getInstance(myProject); }); if (projectFileIndex == null) return; VfsUtilCore.visitChildrenRecursively(myRoot, new VirtualFileVisitor<Void>() { @Override public boolean visitFile(@NotNull VirtualFile file) { if (!shouldVisit(file, projectFileIndex, myRoot)) return false; return visitFileToPush(file, propertiesUpdater); } }); }