com.intellij.openapi.util.io.FileUtil.processFilesRecursively()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(144)

本文整理了Java中com.intellij.openapi.util.io.FileUtil.processFilesRecursively()方法的一些代码示例,展示了FileUtil.processFilesRecursively()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.processFilesRecursively()方法的具体详情如下:
包路径:com.intellij.openapi.util.io.FileUtil
类名称:FileUtil
方法名:processFilesRecursively

FileUtil.processFilesRecursively介绍

暂无

代码示例

代码示例来源:origin: KronicDeth/intellij-elixir

@NotNull
private static List<String> getCompileFilePathsDefault(@NotNull JpsModule module, @NotNull Target target) {
  CommonProcessors.CollectProcessor<File> exFilesCollector = new CommonProcessors.CollectProcessor<File>() {
    @Override
    protected boolean accept(File file) {
      return !file.isDirectory() && FileUtilRt.extensionEquals(file.getName(), ELIXIR_SOURCE_EXTENSION);
    }
  };
  List<JpsModuleSourceRoot> sourceRoots = new ArrayList<>();
  ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.SOURCE));
  if (target.isTests()) {
    ContainerUtil.addAll(sourceRoots, module.getSourceRoots(JavaSourceRootType.TEST_SOURCE));
  }
  for (JpsModuleSourceRoot root : sourceRoots) {
    FileUtil.processFilesRecursively(root.getFile(), exFilesCollector);
  }
  return ContainerUtil.map(exFilesCollector.getResults(), File::getAbsolutePath);
}

代码示例来源:origin: org.jetbrains.kotlin/kotlin-maven-plugin

private boolean hasKotlinFilesInSources() throws MojoExecutionException {
  for (File root : getSourceDirs()) {
    if (root.exists()) {
      boolean sourcesExists = !FileUtil.processFilesRecursively(root, file -> !file.getName().endsWith(".kt"));
      if (sourcesExists) return true;
    }
  }
  return false;
}

代码示例来源:origin: google/ijaas

@Nullable
private Project findProject(String file) {
 LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
 ProjectLocator projectLocator = ProjectLocator.getInstance();
 AtomicReference<Project> ret = new AtomicReference<>();
 FileUtil.processFilesRecursively(
   new File(file),
   (f) -> {
    VirtualFile vf = localFileSystem.findFileByIoFile(f);
    if (vf != null) {
     ret.set(projectLocator.guessProjectForFile(vf));
     return false;
    }
    return true;
   });
 return ret.get();
}

代码示例来源:origin: google/ijaas

@Nullable
private Project findProject(String file) {
 LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
 ProjectLocator projectLocator = ProjectLocator.getInstance();
 AtomicReference<Project> ret = new AtomicReference<>();
 FileUtil.processFilesRecursively(
   new File(file),
   (f) -> {
    VirtualFile vf = localFileSystem.findFileByIoFile(f);
    if (vf != null) {
     ret.set(projectLocator.guessProjectForFile(vf));
     return false;
    }
    return true;
   });
 return ret.get();
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

@Override
@Nullable
public File findFileByNameInDirectory(
  @NotNull final File directory,
  @NotNull final String fileName,
  @Nullable final TaskProgressProcessor<File> progressListenerProcessor
) throws InterruptedException {
  Validate.notNull(directory);
  Validate.isTrue(directory.isDirectory());
  Validate.notNull(fileName);
  final Ref<File> result = Ref.create();
  final Ref<Boolean> interrupted = Ref.create(false);
  FileUtil.processFilesRecursively(directory, file -> {
    if (progressListenerProcessor != null && !progressListenerProcessor.shouldContinue(directory)) {
      interrupted.set(true);
      return false;
    }
    if (StringUtils.endsWith(file.getAbsolutePath(), fileName)) {
      result.set(file);
      return false;
    }
    return true;
  });
  if (interrupted.get()) {
    throw new InterruptedException("Modules scanning has been interrupted.");
  }
  return result.get();
}

相关文章