本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: getChildren
private static File[] getChildren(File dir) {
File[] result = dir.listFiles();
return result == null ? ArrayUtil.EMPTY_FILE_ARRAY : result;
}