boolean (Project project) { FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance(); if (!(fileBasedIndex instanceof FileBasedIndexImpl)) return false; long start = System.currentTimeMillis(); return !((FileBasedIndexImpl)fileBasedIndex).processChangedFiles(project, new Processor<>() { int filesInProjectToBeIndexed; long sizeOfFilesToBeIndexed; @Override public boolean process(VirtualFile file) { ++filesInProjectToBeIndexed; if (file.isValid() && !file.isDirectory()) sizeOfFilesToBeIndexed += file.getLength(); return filesInProjectToBeIndexed < ourMinFilesToStartDumbMode && sizeOfFilesToBeIndexed < ourMinFilesSizeToStartDumbMode && System.currentTimeMillis() < start + 100; } }); }