本文整理汇总了Java中org.apache.oro.io.GlobFilenameFilter类的典型用法代码示例。如果您正苦于以下问题:Java GlobFilenameFilter类的具体用法?Java GlobFilenameFilter怎么用?Java GlobFilenameFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GlobFilenameFilter类属于org.apache.oro.io包,在下文中一共展示了GlobFilenameFilter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandGlob
import org.apache.oro.io.GlobFilenameFilter; //导入依赖的package包/类
private String[] expandGlob(String filePath, String fileNamePattern, File dir) {
boolean recurse = (fileNamePattern.matches("\\*\\*.*")) ? true : false;
FilenameFilter fileFilter = new GlobFilenameFilter(fileNamePattern,
GlobCompiler.DEFAULT_MASK | GlobCompiler.CASE_INSENSITIVE_MASK);
String[] filteredFiles = getFiles(dir, fileFilter, recurse, "").toArray(new String[0]);
if (filteredFiles == null || filteredFiles.length == 0) {
try {
String error = "The patterns/paths "
+ filePath + " (" + dir + ") "
+ " used in the configuration"
+ " file didn't match any file, the files patterns/paths need to"
+ " be relative " + basePath.getCanonicalPath();
throw new IllegalArgumentException(error);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Arrays.sort(filteredFiles, String.CASE_INSENSITIVE_ORDER);
return filteredFiles;
}
示例2: processCheckedOutDirectory
import org.apache.oro.io.GlobFilenameFilter; //导入依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
File[] files = directory.listFiles((FilenameFilter) new GlobFilenameFilter("*" + ProjectFileType.DOT_DEFAULT_EXTENSION));
if (files != null && files.length > 0) {
int rc = Messages
.showYesNoDialog(project, VcsBundle.message("checkout.open.project.prompt", getProductNameWithArticle(), files[0].getPath()),
VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
if (rc == Messages.YES) {
ProjectUtil.openProject(files[0].getPath(), project, false);
}
return true;
}
return false;
}
示例3: processCheckedOutDirectory
import org.apache.oro.io.GlobFilenameFilter; //导入依赖的package包/类
@Override
public boolean processCheckedOutDirectory(Project project, File directory) {
File[] files = directory.listFiles((FilenameFilter) new GlobFilenameFilter("*" + ProjectFileType.DOT_DEFAULT_EXTENSION));
if (files != null && files.length > 0) {
int rc = Messages
.showYesNoDialog(project, VcsBundle.message("checkout.open.project.prompt", getProductNameWithArticle(), files[0].getPath()),
VcsBundle.message("checkout.title"), Messages.getQuestionIcon());
if (rc == 0) {
ProjectUtil.openProject(files[0].getPath(), project, false);
}
return true;
}
return false;
}
示例4: resolveFiles
import org.apache.oro.io.GlobFilenameFilter; //导入依赖的package包/类
private Set<FileInfo> resolveFiles(List<String> files, boolean serveOnly) {
if (files != null) {
Set<FileInfo> resolvedFiles = new LinkedHashSet<FileInfo>();
for (String f : files) {
f = pathRewriter.rewrite(f);
boolean isPatch = f.startsWith("patch");
if (isPatch) {
String[] tokens = f.split(" ", 2);
f = tokens[1].trim();
}
if (f.startsWith("http://") || f.startsWith("https://")) {
resolvedFiles.add(new FileInfo(f, -1, -1, false, false, null, f));
} else {
File file = basePath != null ? new File(basePath.getAbsoluteFile(), f) : new File(f);
File testFile = file.getAbsoluteFile();
File dir = testFile.getParentFile().getAbsoluteFile();
final String pattern = file.getName();
String[] filteredFiles = dir.list(new GlobFilenameFilter(pattern,
GlobCompiler.DEFAULT_MASK | GlobCompiler.CASE_INSENSITIVE_MASK));
if (filteredFiles == null || filteredFiles.length == 0) {
String error = "The patterns/paths " + f + " used in the configuration"
+ " file didn't match any file, the files patterns/paths need to be relative to"
+ " the configuration file.";
System.err.println(error);
throw new RuntimeException(error);
}
Arrays.sort(filteredFiles, String.CASE_INSENSITIVE_ORDER);
for (String filteredFile : filteredFiles) {
File resolvedFile =
pathResolver.resolvePath(dir.getPath() + File.separator + filteredFile);
resolvedFiles.add(new FileInfo(resolvedFile.getAbsolutePath(), resolvedFile.lastModified(), -1,
isPatch, serveOnly, null, filteredFile));
}
}
}
return resolvedFiles;
}
return Collections.emptySet();
}