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


Java ArrayUtil.EMPTY_FILE_ARRAY属性代码示例

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


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

示例1: listFiles

/**
 * Lists the files of the given directory and returns them as an array which
 * is never null. This simplifies processing file listings from for each
 * loops since {@link File#listFiles} can return null. This method simply
 * wraps it and makes sure it returns an empty array instead if necessary.
 *
 * @param dir the directory to list
 * @return the children, or empty if it has no children, is not a directory,
 *         etc.
 */
@NotNull
public static File[] listFiles(@Nullable File dir) {
  if (dir != null) {
    File[] files = dir.listFiles();
    if (files != null) {
      return files;
    }
  }
  return ArrayUtil.EMPTY_FILE_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:WizardUtils.java

示例2: listXmlFiles

@NotNull
private static File[] listXmlFiles(final File dir) {
  File[] files = dir.listFiles(FileFilters.filesWithExtension("xml"));
  return files != null ? files : ArrayUtil.EMPTY_FILE_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JpsProjectLoader.java

示例3: processRecursively

private List<Pair<File, Integer>> processRecursively(File dir, BitSet enabledDetectors) {
  List<Pair<File, Integer>> parentsToSkip = new SmartList<Pair<File, Integer>>();

  if (myTypeManager.isFileIgnored(dir.getName())) {
    return parentsToSkip;
  }
  if (myProgressIndicator != null) {
    if (myProgressIndicator.isCanceled()) {
      return parentsToSkip;
    }
    myProgressIndicator.setText2(dir.getPath());
  }

  File[] children = dir.listFiles();

  if (children == null) {
    children = ArrayUtil.EMPTY_FILE_ARRAY;
  }

  BitSet enabledForChildren = enabledDetectors;
  for (int i = 0, detectorsLength = myDetectors.length; i < detectorsLength; i++) {
    if (!enabledDetectors.get(i)) continue;

    final ProjectStructureDetector.DirectoryProcessingResult result = myDetectors[i].detectRoots(dir, children, myBaseDir, myDetectedRoots[i]);

    if (!result.isProcessChildren()) {
      if (enabledForChildren == enabledDetectors) {
        enabledForChildren = new BitSet();
        enabledForChildren.or(enabledDetectors);
      }
      enabledForChildren.set(i, false);
    }

    final File parentToSkip = result.getParentToSkip();
    if (parentToSkip != null && !parentToSkip.equals(dir)) {
      parentsToSkip.add(Pair.create(parentToSkip, i));
    }
  }

  if (!enabledForChildren.isEmpty()) {
    for (File child : children) {
      if (child.isDirectory()) {
        final List<Pair<File, Integer>> toSkip = processRecursively(child, enabledForChildren);
        if (!toSkip.isEmpty()) {
          if (enabledForChildren == enabledDetectors) {
            enabledForChildren = new BitSet();
            enabledForChildren.or(enabledDetectors);
          }
          for (Pair<File, Integer> pair : toSkip) {
            enabledForChildren.set(pair.getSecond(), false);
            if (!pair.getFirst().equals(dir)) {
              parentsToSkip.add(pair);
            }
          }
          if (enabledForChildren.isEmpty()) {
            break;
          }
        }
      }
    }
  }
  return parentsToSkip;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:63,代码来源:RootDetectionProcessor.java

示例4: getSettingsXmlFiles

@NotNull
private File[] getSettingsXmlFiles(@NotNull String dirName) {
  final File librariesDir = new File(mySettingsBaseDir, dirName);
  return librariesDir.exists() ? librariesDir.listFiles(FileFilters.filesWithExtension("xml")) : ArrayUtil.EMPTY_FILE_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ConversionContextImpl.java

示例5: getChildren

private static File[] getChildren(File dir) {
  File[] result = dir.listFiles();
  return result == null ? ArrayUtil.EMPTY_FILE_ARRAY : result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:MavenFoldersImporter.java


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