当前位置: 首页>>代码示例>>Java>>正文


Java VfsUtilCore.visitChildrenRecursively方法代码示例

本文整理汇总了Java中com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively方法的典型用法代码示例。如果您正苦于以下问题:Java VfsUtilCore.visitChildrenRecursively方法的具体用法?Java VfsUtilCore.visitChildrenRecursively怎么用?Java VfsUtilCore.visitChildrenRecursively使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.vfs.VfsUtilCore的用法示例。


在下文中一共展示了VfsUtilCore.visitChildrenRecursively方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findApplicationFileRecursively

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Nullable
private File findApplicationFileRecursively(@NotNull final VirtualFile appDirectory,
                                            @NotNull final String applicationName) {
  final VirtualFileVisitor<VirtualFile> fileVisitor = new VirtualFileVisitor<VirtualFile>(VirtualFileVisitor
      .limit(APP_DEPTH_SEARCH), VirtualFileVisitor.SKIP_ROOT, VirtualFileVisitor.NO_FOLLOW_SYMLINKS) {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (ApplicationDictionary.SUPPORTED_APPLICATION_EXTENSIONS.contains(file.getExtension())) {
        if (applicationName.equals(file.getNameWithoutExtension())) {
          throw new MyStopVisitingException(file);
        }
        return false; //do not search inside application bundles
      }
      return true;
    }
  };
  try {
    VfsUtilCore.visitChildrenRecursively(appDirectory, fileVisitor, MyStopVisitingException.class);
  } catch (MyStopVisitingException e) {
    LOG.debug("Application file found for application " + applicationName + " : " + e.getResult());
    return new File(e.getResult().getPath());
  }
  return null;
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:25,代码来源:AppleScriptSystemDictionaryRegistryService.java

示例2: getAllSubFiles

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static Collection<VirtualFile> getAllSubFiles(VirtualFile virtualFile)
{
    Collection<VirtualFile> list = new ArrayList<>();

    VfsUtilCore.visitChildrenRecursively(virtualFile, new VirtualFileVisitor() {
        @Override
        public boolean visitFile(@NotNull VirtualFile file) {
            if (!file.isDirectory()) {
                list.add(file);
            }
            return super.visitFile(file);
        }
    });

    return list;
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:17,代码来源:VfsUtil.java

示例3: loadAllModulesUnder

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Nullable
protected Module loadAllModulesUnder(@NotNull VirtualFile rootDir, @Nullable final Consumer<Module> moduleConsumer) {
  final Ref<Module> result = Ref.create();

  VfsUtilCore.visitChildrenRecursively(rootDir, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (!file.isDirectory() && file.getName().endsWith(ModuleFileType.DOT_DEFAULT_EXTENSION)) {
        ModuleImpl module = (ModuleImpl)loadModule(file.getPath());
        if (moduleConsumer != null) {
          moduleConsumer.consume(module);
        }
        result.setIfNull(module);
      }
      return true;
    }
  });

  return result.get();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ModuleTestCase.java

示例4: processFolder

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected void processFolder(final HashSet<String> seenNames, final PsiManager manager, final VirtualFile folder) {
  VfsUtilCore.visitChildrenRecursively(folder, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (myExcludedFolders.contains(file)) {
        return false;
      }
      if (!file.isDirectory()) {
        final PsiFile psiFile = manager.findFile(file);
        if (psiFile != null) {
          processFile(psiFile, seenNames);
        }
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SpellCheckerDictionaryGenerator.java

示例5: getFilesWithBom

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static void getFilesWithBom(@NotNull VirtualFile root, @NotNull final List<VirtualFile> result, final boolean all) {
  VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (file.isDirectory()) {
        if (!all && !result.isEmpty()) {
          return false;
        }
      }
      else if (file.getBOM() != null) {
        result.add(file);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RemoveBomAction.java

示例6: iterateRecursively

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static void iterateRecursively(@Nullable final VirtualFile root,
                                      @NotNull final ContentIterator processor,
                                      @Nullable final ProgressIndicator indicator,
                                      @Nullable final Set<VirtualFile> visitedRoots,
                                      @Nullable final ProjectFileIndex projectFileIndex) {
  if (root == null) {
    return;
  }

  VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (visitedRoots != null && !root.equals(file) && file.isDirectory() && !visitedRoots.add(file)) {
        return false; // avoid visiting files more than once, e.g. additional indexed roots intersect sometimes
      }
      if (projectFileIndex != null && projectFileIndex.isExcluded(file)) {
        return false;
      }
      if (indicator != null) indicator.checkCanceled();

      processor.processFile(file);
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:FileBasedIndex.java

示例7: removeFilesAndDirsRecursively

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
void removeFilesAndDirsRecursively(@NotNull VirtualFile vFile) {
  DebugUtil.startPsiModification("removeFilesAndDirsRecursively");
  try {
    VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() {
      @Override
      public boolean visitFile(@NotNull VirtualFile file) {
        if (file.isDirectory()) {
          myVFileToPsiDirMap.remove(file);
        }
        else {
          FileViewProvider viewProvider = myVFileToViewProviderMap.remove(file);
          if (viewProvider instanceof SingleRootFileViewProvider) {
            ((SingleRootFileViewProvider)viewProvider).markInvalidated();
          }
        }
        return true;
      }
    });
  }
  finally {
    DebugUtil.finishPsiModification();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FileManagerImpl.java

示例8: modifyRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
@Override
protected void modifyRoots(@NotNull VirtualFile vFile, @NotNull ContentEntry entry) {
    VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() {
        @Override
        public boolean visitFile(@NotNull VirtualFile file) {
            if (file.isDirectory() && file.is(VFileProperty.SYMLINK)) {
                entry.addExcludeFolder(file);
                return false;
            } else {
                return true;
            }
        }
    });
}
 
开发者ID:NeoFusion,项目名称:idea-exclude-symlinks-plugin,代码行数:15,代码来源:MarkSymlinksAsExcludedAction.java

示例9: discoverApplicationsInDirectory

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private void discoverApplicationsInDirectory(@NotNull VirtualFile appsDirVFile) {
  VfsUtilCore.visitChildrenRecursively(appsDirVFile, new VirtualFileVisitor(VirtualFileVisitor.limit(APP_DEPTH_SEARCH)) {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (ApplicationDictionaryImpl.extensionSupported(file.getExtension())) {
        if (!"xml".equals(file.getExtension())) {
          discoveredApplicationNames.add(file.getNameWithoutExtension());
        }
        return false;
      }
      return file.isDirectory();
    }
  });
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:15,代码来源:AppleScriptSystemDictionaryRegistryService.java

示例10: setUpExternalUpAnnotations

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private void setUpExternalUpAnnotations() {
  String annotationsPath = PathManagerEx.getTestDataPath() + "/codeInspection/bytecodeAnalysis/annotations";
  final VirtualFile annotationsDir = LocalFileSystem.getInstance().refreshAndFindFileByPath(annotationsPath);
  assertNotNull(annotationsDir);

  ModuleRootModificationUtil.updateModel(myModule, new AsynchConsumer<ModifiableRootModel>() {
    @Override
    public void finished() {
    }

    @Override
    public void consume(ModifiableRootModel modifiableRootModel) {
      final LibraryTable libraryTable = modifiableRootModel.getModuleLibraryTable();
      Library[] libs = libraryTable.getLibraries();
      for (Library library : libs) {
        final Library.ModifiableModel libraryModel = library.getModifiableModel();
        libraryModel.addRoot(annotationsDir, AnnotationOrderRootType.getInstance());
        libraryModel.commit();
      }
      Sdk sdk = modifiableRootModel.getSdk();
      if (sdk != null) {
        SdkModificator sdkModificator = sdk.getSdkModificator();
        sdkModificator.addRoot(annotationsDir, AnnotationOrderRootType.getInstance());
        sdkModificator.commitChanges();
      }
    }
  });

  VfsUtilCore.visitChildrenRecursively(annotationsDir, new VirtualFileVisitor() { });
  annotationsDir.refresh(false, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:BytecodeAnalysisIntegrationTest.java

示例11: suggestRoots

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
/**
 * Scan directory and detect java source roots within it. The source root is detected as the following:
 * <ol>
 * <li>It contains at least one Java file.</li>
 * <li>Java file is located in the sub-folder that matches package statement in the file.</li>
 * </ol>
 *
 * @param dir a directory to scan
 * @param progressIndicator
 * @return a list of found source roots within directory. If no source roots are found, a empty list is returned.
 */
@NotNull
public static List<VirtualFile> suggestRoots(@NotNull VirtualFile dir, @NotNull final ProgressIndicator progressIndicator) {
  if (!dir.isDirectory()) {
    return ContainerUtil.emptyList();
  }

  final FileTypeManager typeManager = FileTypeManager.getInstance();
  final ArrayList<VirtualFile> foundDirectories = new ArrayList<VirtualFile>();
  try {
    VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor() {
      @NotNull
      @Override
      public Result visitFileEx(@NotNull VirtualFile file) {
        progressIndicator.checkCanceled();

        if (file.isDirectory()) {
          if (typeManager.isFileIgnored(file) || StringUtil.startsWithIgnoreCase(file.getName(), "testData")) {
            return SKIP_CHILDREN;
          }
        }
        else {
          FileType type = typeManager.getFileTypeByFileName(file.getName());
          if (StdFileTypes.JAVA == type) {
            VirtualFile root = suggestRootForJavaFile(file);
            if (root != null) {
              foundDirectories.add(root);
              return skipTo(root);
            }
          }
        }

        return CONTINUE;
      }
    });
  }
  catch (ProcessCanceledException ignore) { }

  return foundDirectories;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:JavaVfsSourceRootDetectionUtil.java

示例12: addRecursively

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static void addRecursively(final Collection<VirtualFile> container, VirtualFile fromDirectory, final FileType fileType) {
  VfsUtilCore.visitChildrenRecursively(fromDirectory, new VirtualFileVisitor(VirtualFileVisitor.SKIP_ROOT) {
    @Override
    public boolean visitFile(@NotNull VirtualFile child) {
      if (!child.isDirectory() && (fileType == null || fileType.equals(child.getFileType()))) {
        container.add(child);
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileSetCompileScope.java

示例13: collectJarFiles

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
public static void collectJarFiles(final VirtualFile dir, final List<VirtualFile> container, final boolean recursively) {
  VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor(SKIP_ROOT, recursively ? null : ONE_LEVEL_DEEP) {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      final VirtualFile jarRoot = file.isDirectory() ? null : StandardFileSystems.getJarRootForLocalFile(file);
      if (jarRoot != null) {
        container.add(jarRoot);
        return false;
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LibraryImpl.java

示例14: initFilesSet

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
protected void initFilesSet() {
  if (myType == FILE) {
    myFilesSet = new HashSet<VirtualFile>(1);
    myFilesSet.add(((PsiFileSystemItem)myElement).getVirtualFile());
  }
  else if (myType == DIRECTORY || myType == PROJECT || myType == MODULES || myType == MODULE || myType == CUSTOM) {
    myFilesSet = new HashSet<VirtualFile>();
    accept(createFileSearcher(), false);
  }
  else if (myType == VIRTUAL_FILES) {
    myFilesSet = new HashSet<VirtualFile>();
    final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
    for (Iterator<VirtualFile> iterator = myVFiles.iterator(); iterator.hasNext(); ) {
      final VirtualFile vFile = iterator.next();
      VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() {
        @NotNull
        @Override
        public Result visitFileEx(@NotNull VirtualFile file) {
          boolean ignored = fileIndex.isExcluded(file);
          if (!ignored && !file.isDirectory()) {
            myFilesSet.add(file);
          }
          return ignored ? SKIP_CHILDREN : CONTINUE;
        }
      });

      if (vFile.isDirectory()) {
        iterator.remove();
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:AnalysisScope.java

示例15: fixSeparators

import com.intellij.openapi.vfs.VfsUtilCore; //导入方法依赖的package包/类
private static void fixSeparators(VirtualFile vFile) {
  VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() {
    @Override
    public boolean visitFile(@NotNull VirtualFile file) {
      if (!file.isDirectory() && !file.getFileType().isBinary()) {
        final Document document = FileDocumentManager.getInstance().getDocument(file);
        if (areSeparatorsBroken(document)) {
          fixSeparators(document);
        }
      }
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FixLineSeparatorsAction.java


注:本文中的com.intellij.openapi.vfs.VfsUtilCore.visitChildrenRecursively方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。