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


Java ContainerUtil.createConcurrentWeakMap方法代码示例

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


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

示例1: computeForOverloadedCandidate

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private <T> T computeForOverloadedCandidate(final Computable<T> computable, final PsiSubstitutor substitutor) {
  Map<PsiElement, CurrentCandidateProperties> map = CURRENT_CANDIDATE.get();
  if (map == null) {
    map = ContainerUtil.createConcurrentWeakMap();
    CURRENT_CANDIDATE.set(map);
  }
  final PsiElement argumentList = getMarkerList();
  final CurrentCandidateProperties alreadyThere = map.put(argumentList,
                                                          new CurrentCandidateProperties(this, substitutor, isVarargs(), true));
  try {
    return computable.compute();
  }
  finally {
    if (alreadyThere == null) {
      map.remove(argumentList);
    } else {
      map.put(argumentList, alreadyThere);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MethodCandidateInfo.java

示例2: shouldAbbreviateName

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static boolean shouldAbbreviateName(PsiPackage aPackage) {
  final Project project = aPackage.getProject();
  ConcurrentMap<PsiPackage, Boolean> map = project.getUserData(SHOULD_ABBREV_PACK_KEY);
  if (map == null) {
    final ConcurrentMap<PsiPackage, Boolean> newMap = ContainerUtil.createConcurrentWeakMap();
    map = ((UserDataHolderEx)project).putUserDataIfAbsent(SHOULD_ABBREV_PACK_KEY, newMap);
    if (map == newMap) {
      ((PsiManagerEx)PsiManager.getInstance(project)).registerRunnableToRunOnChange(new Runnable() {
        @Override
        public void run() {
          newMap.clear();
        }
      });
    }
  }

  Boolean ret = map.get(aPackage);
  if (ret != null) return ret;
  ret = scanPackages(aPackage, 1);
  map.put(aPackage, ret);
  return ret;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:TreeViewUtil.java

示例3: LoaderFactory

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public LoaderFactory(final Project project) {
  myProject = project;
  myModule2ClassLoader = ContainerUtil.createConcurrentWeakMap();
  myConnection = myProject.getMessageBus().connect();
  myConnection.subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
    public void rootsChanged(final ModuleRootEvent event) {
      clearClassLoaderCache();
    }
  });

  Disposer.register(project, new Disposable() {
    public void dispose() {
      myConnection.disconnect();
      myModule2ClassLoader.clear();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LoaderFactory.java

示例4: xmlFileWasChanged

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private boolean xmlFileWasChanged(VirtualFile xmlFile, VFileEvent event) {
  if (!xmlFile.isValid() || !(event instanceof VFileContentChangeEvent)) return true;

  ConcurrentMap<Project, Integer> map = xmlFile.getUserData(CRC_WITHOUT_SPACES);
  if (map == null) {
    ConcurrentMap<Project, Integer> value = ContainerUtil.createConcurrentWeakMap();
    map = xmlFile.putUserDataIfAbsent(CRC_WITHOUT_SPACES, value);
  }

  Integer crc = map.get(myProject);
  Integer newCrc;

  try {
    newCrc = MavenUtil.crcWithoutSpaces(xmlFile);
  }
  catch (IOException ignored) {
    return true;
  }

  if (newCrc == -1 // XML is invalid
      || newCrc.equals(crc)) {
    return false;
  }
  else {
    map.put(myProject, newCrc);
    return true;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MavenProjectsManagerWatcher.java


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