本文整理了Java中com.intellij.openapi.util.io.FileUtil.findFilesByMask()
方法的一些代码示例,展示了FileUtil.findFilesByMask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.findFilesByMask()
方法的具体详情如下:
包路径:com.intellij.openapi.util.io.FileUtil
类名称:FileUtil
方法名:findFilesByMask
暂无
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
Pattern pattern = Pattern.compile(".*\\.go");
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if (!filesByMask.isEmpty()) {
result.add(new DetectedProjectRoot(dir) {
@NotNull
@Override
public String getRootTypeName() {
return GoConstants.GO;
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
代码示例来源:origin: KronicDeth/intellij-elixir
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir, @NotNull File[] children, @NotNull File base, @NotNull List<DetectedProjectRoot> result) {
Pattern pattern = Pattern.compile(".*\\.ex[s]*");
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if(!filesByMask.isEmpty()){
result.add(new DetectedProjectRoot(dir) {
@NotNull
@Override
public String getRootTypeName() {
return "Elixir";
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
代码示例来源:origin: ballerina-platform/ballerina-lang
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir, @NotNull File[] children, @NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
// We only need to mark the root as a Ballerina project root only if there is at least one Ballerina file.
Pattern pattern = Pattern.compile(".*\\.bal");
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if (!filesByMask.isEmpty()) {
// There can be only one project root, it is the directory that the user selects.
result.add(new DetectedProjectRoot(base) {
@NotNull
@Override
public String getRootTypeName() {
return "Ballerina";
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin
static List<File> findMathematicaKernels(String homePath) {
List<File> kernels = new ArrayList<>();
File rootDir = new File(homePath);
Pattern kernelPattern;
if (OS.contains("win")) {
kernelPattern = Pattern.compile(".*MathKernel.exe");
} else {
kernelPattern = Pattern.compile(".*MathKernel");
}
if (rootDir.isDirectory()) {
final List<File> foundKernels = FileUtil.findFilesByMask(kernelPattern, rootDir);
for (File file : foundKernels) {
if (file.canExecute())
kernels.add(file);
}
}
return kernels;
}
代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin
@SuppressWarnings("unused")
private static void addAddOnPackageSources(SdkModificator sdkModificator, String homePath) {
String addOnsPath = homePath + File.separatorChar + "AddOns";
File addOnsFile;
addOnsFile = OS.contains("mac") && !Util.isAccessibleDir(addOnsPath) ?
new File(homePath + File.separatorChar + "Contents/AddOns") : new File(addOnsPath);
if (addOnsFile.isDirectory()) {
final List<File> initFiles = FileUtil.findFilesByMask(PACLET_INFO_PATTERN, addOnsFile);
String componentsPath = homePath + File.separatorChar + "SystemFiles" + File.separator + "Components";
initFiles.addAll(FileUtil.findFilesByMask(PACLET_INFO_PATTERN, new File(componentsPath)));
for (File file : initFiles) {
if (PACLET_INFO_PATTERN.matcher(file.getPath()).matches()) {
final VirtualFile packageDirectory = LocalFileSystem.getInstance().findFileByPath(file.getParent());
sdkModificator.addRoot(packageDirectory, OrderRootType.SOURCES);
}
}
}
}
代码示例来源:origin: halirutan/Mathematica-IntelliJ-Plugin
private static void addJLinkJars(SdkModificator sdkModificator, String homePath) {
final JarFileSystem jarFileSystem = JarFileSystem.getInstance();
Pattern jlinkPattern = Pattern.compile(".*JLink.jar");
List<File> jlinkFiles = FileUtil.findFilesByMask(jlinkPattern, new File(homePath));
for (File jlinkFile : jlinkFiles) {
jarFileSystem.setNoCopyJarForPath(jlinkFile.getAbsolutePath() + JarFileSystem.JAR_SEPARATOR);
VirtualFile vFile = jarFileSystem.findFileByPath(jlinkFile.getAbsolutePath() + JarFileSystem.JAR_SEPARATOR);
sdkModificator.addRoot(vFile, OrderRootType.CLASSES);
}
}
代码示例来源:origin: liias/monkey
final List<File> mcFiles = FileUtil.findFilesByMask(sourcePattern, projectRoot);
final List<File> xmlFiles = FileUtil.findFilesByMask(resourcePattern, projectRoot);
final List<String> resourceFilePaths = xmlFiles.stream()
.filter(file -> file != null && file.getParentFile().getAbsolutePath().contains("resource"))
代码示例来源:origin: BashSupport/BashSupport
private void assertNoErrors(String filenameRegex) throws Exception {
try {
BashProjectSettings.storedSettings(getProject()).setEvalEscapesEnabled(true);
List<File> files = FileUtil.findFilesByMask(Pattern.compile(filenameRegex), new File(getTestDataPath()));
int count = 0;
int errors = 0;
for (File file : files) {
LOG.info("Checking file: " + file.getAbsolutePath());
configureByFile(file.getName(), null);
errors += assertNoParsingErrors();
count++;
}
Assert.assertTrue("No files parsed.", count > 0);
Assert.assertTrue("There are " + errors + " errors", errors == 0);
} finally {
BashProjectSettings.storedSettings(getProject()).setEvalEscapesEnabled(false);
}
}
内容来源于网络,如有侵权,请联系作者删除!