Beispiel #1
0
 public static boolean iterateRecursively(
     @Nullable final VirtualFile root, @NotNull final ContentIterator processor) {
   if (root != null) {
     if (root.isDirectory()) {
       for (VirtualFile file : root.getChildren()) {
         if (file.isDirectory()) {
           if (!iterateRecursively(file, processor)) return false;
         } else {
           if (!processor.processFile(file)) return false;
         }
       }
     } else {
       if (!processor.processFile(root)) return false;
     }
   }
   return true;
 }
  private void iterateIndexableFilesIn_internal(VirtualFile file, ContentIterator iterator) {
    if (CacheUtil.isIgnored(file, myRootManager)) return;

    if (file.isDirectory()) {
      for (VirtualFile child : file.getChildren()) {
        iterateIndexableFilesIn_internal(child, iterator);
      }
    } else {
      iterator.processFile(file);
    }
  }
  @Override
  public void iterateIndexableFilesIn(VirtualFile file, ContentIterator iterator) {
    if (!isInSet(file)) return;

    if (file.isDirectory()) {
      for (VirtualFile child : file.getChildren()) {
        iterateIndexableFilesIn(child, iterator);
      }
    } else {
      iterator.processFile(file);
    }
  }
 private void addFilesUnderDirectory(
     @NotNull PsiDirectory directory, @NotNull ContentIterator iterator) {
   for (PsiElement child : directory.getChildren()) {
     if (child instanceof PsiFile) {
       VirtualFile virtualFile = ((PsiFile) child).getVirtualFile();
       if (virtualFile != null) {
         iterator.processFile(virtualFile);
       }
     } else if (myFindModel.isWithSubdirectories() && child instanceof PsiDirectory) {
       addFilesUnderDirectory((PsiDirectory) child, iterator);
     }
   }
 }