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


Java MavenProject.getCachedValue方法代码示例

本文整理汇总了Java中org.jetbrains.idea.maven.project.MavenProject.getCachedValue方法的典型用法代码示例。如果您正苦于以下问题:Java MavenProject.getCachedValue方法的具体用法?Java MavenProject.getCachedValue怎么用?Java MavenProject.getCachedValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jetbrains.idea.maven.project.MavenProject的用法示例。


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

示例1: getFilteredResourcesRoots

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
private static Set<VirtualFile> getFilteredResourcesRoots(@NotNull MavenProject mavenProject) {
  Pair<Long, Set<VirtualFile>> cachedValue = mavenProject.getCachedValue(FILTERED_RESOURCES_ROOTS_KEY);

  if (cachedValue == null || cachedValue.first != VirtualFileManager.getInstance().getModificationCount()) {
    Set<VirtualFile> set = null;

    for (MavenResource resource : ContainerUtil.concat(mavenProject.getResources(), mavenProject.getTestResources())) {
      if (!resource.isFiltered()) continue;

      VirtualFile resourceDir = LocalFileSystem.getInstance().findFileByPath(resource.getDirectory());
      if (resourceDir == null) continue;

      if (set == null) {
        set = new HashSet<VirtualFile>();
      }

      set.add(resourceDir);
    }

    if (set == null) {
      set = Collections.emptySet();
    }

    cachedValue = Pair.create(VirtualFileManager.getInstance().getModificationCount(), set);
    mavenProject.putCachedValue(FILTERED_RESOURCES_ROOTS_KEY, cachedValue);
  }

  return cachedValue.second;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MavenDomUtil.java

示例2: getDelimitersPattern

import org.jetbrains.idea.maven.project.MavenProject; //导入方法依赖的package包/类
@NotNull
public static Pattern getDelimitersPattern(MavenProject mavenProject) {
  Pattern res = mavenProject.getCachedValue(KEY);
  if (res == null) {
    Element cfg = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin");
    if (cfg == null) {
      res = DEFAULT_DELIMITERS;
    }
    else {
      List<String> delimiters = MavenJDOMUtil.findChildrenValuesByPath(cfg, "delimiters", "delimiter");
      if (delimiters.isEmpty() || delimiters.size() > 10) {
        res = DEFAULT_DELIMITERS;
      }
      else {
        StringBuilder patternBuilder = new StringBuilder();
        
        for (String delimiter : delimiters) {
          delimiter = delimiter.trim();
          if (delimiter.isEmpty()) continue;

          int ind = delimiter.indexOf('*');
          if (ind >= 0) {
            appendDelimiter(patternBuilder, delimiter.substring(0, ind), delimiter.substring(ind + 1));
          }
          else {
            appendDelimiter(patternBuilder, delimiter, delimiter);
          }
        }

        // <useDefaultDelimiters> is not used if custom delimiters are not present.
        boolean useDefaultDelimiters = true;

        String useDefaultDelimitersText = cfg.getChildText("useDefaultDelimiters");
        if (StringUtil.isNotEmpty(useDefaultDelimitersText)) {
          useDefaultDelimiters = Boolean.parseBoolean(useDefaultDelimitersText);
        }

        if (useDefaultDelimiters) {
          appendDelimiter(patternBuilder, "${", "}");
          appendDelimiter(patternBuilder, "@", "@");
        }

        res = Pattern.compile(patternBuilder.toString());
      }
    }

    res = mavenProject.putCachedValue(KEY, res);
  }

  return res;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:MavenFilteredPropertyPsiReferenceProvider.java


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