當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。