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


Java GlobFilenameFilter类代码示例

本文整理汇总了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;
}
 
开发者ID:BladeRunnerJS,项目名称:brjs-JsTestDriver,代码行数:24,代码来源:PathResolver.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ProjectCheckoutListener.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:ProjectCheckoutListener.java

示例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();
}
 
开发者ID:BladeRunnerJS,项目名称:brjs-JsTestDriver,代码行数:47,代码来源:ConfigurationParser.java


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