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


Java ContainerUtil.newConcurrentMap方法代码示例

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


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

示例1: getCachedClassInDumbMode

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private PsiClass[] getCachedClassInDumbMode(final String name, GlobalSearchScope scope) {
  Map<GlobalSearchScope, Map<String, PsiClass[]>> scopeMap = SoftReference.dereference(myDumbModeFullCache);
  if (scopeMap == null) {
    myDumbModeFullCache = new SoftReference<Map<GlobalSearchScope, Map<String, PsiClass[]>>>(scopeMap = ContainerUtil.newConcurrentMap());
  }
  Map<String, PsiClass[]> map = scopeMap.get(scope);
  if (map == null) {
    // before parsing all files in this package, try cheap heuristics: check if 'name' is a subpackage, check files named like 'name'
    PsiClass[] array = findClassesHeuristically(name, scope);
    if (array != null) return array;

    map = new HashMap<String, PsiClass[]>();
    for (PsiClass psiClass : getClasses(scope)) {
      String psiClassName = psiClass.getName();
      if (psiClassName != null) {
        PsiClass[] existing = map.get(psiClassName);
        map.put(psiClassName, existing == null ? new PsiClass[]{psiClass} : ArrayUtil.append(existing, psiClass));
      }
    }
    scopeMap.put(scope, map);
  }
  PsiClass[] classes = map.get(name);
  return classes == null ? PsiClass.EMPTY_ARRAY : classes;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PsiPackageImpl.java

示例2: ExternalProjectDataService

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public ExternalProjectDataService() {
  myExternalRootProjects = new ConcurrentFactoryMap<Pair<ProjectSystemId, File>, ExternalProject>() {

    @Override
    protected Map<Pair<ProjectSystemId, File>, ExternalProject> createMap() {
      return ContainerUtil.newConcurrentMap(ExternalSystemUtil.HASHING_STRATEGY);
    }

    @Nullable
    @Override
    protected ExternalProject create(Pair<ProjectSystemId, File> key) {
      return new ExternalProjectSerializer().load(key.first, key.second);
    }

    @Override
    public ExternalProject put(Pair<ProjectSystemId, File> key, ExternalProject value) {
      new ExternalProjectSerializer().save(value);
      return super.put(key, value);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ExternalProjectDataService.java

示例3: findClassesHeuristically

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private PsiClass[] findClassesHeuristically(final String name, GlobalSearchScope scope) {
  if (findSubPackageByName(name) != null) {
    return PsiClass.EMPTY_ARRAY;
  }

  Map<Pair<GlobalSearchScope, String>, PsiClass[]> partial = SoftReference.dereference(myDumbModePartialCache);
  if (partial == null) {
    myDumbModePartialCache = new SoftReference<Map<Pair<GlobalSearchScope, String>, PsiClass[]>>(partial = ContainerUtil.newConcurrentMap());
  }
  PsiClass[] result = partial.get(Pair.create(scope, name));
  if (result == null) {
    List<PsiClass> fastClasses = ContainerUtil.newArrayList();
    for (PsiDirectory directory : getDirectories(scope)) {
      List<PsiFile> sameNamed = ContainerUtil.filter(directory.getFiles(), new Condition<PsiFile>() {
        @Override
        public boolean value(PsiFile file) {
          return file.getName().contains(name);
        }
      });
      Collections.addAll(fastClasses, CoreJavaDirectoryService.getPsiClasses(directory, sameNamed.toArray(new PsiFile[sameNamed.size()])));
    }
    if (!fastClasses.isEmpty()) {
      partial.put(Pair.create(scope, name), result = fastClasses.toArray(new PsiClass[fastClasses.size()]));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:PsiPackageImpl.java

示例4: createMap

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static Map<SliceNode, Collection<PsiElement>> createMap() {
  return new FactoryMap<SliceNode, Collection<PsiElement>>() {
    @Override
    protected Map<SliceNode, Collection<PsiElement>> createMap() {
      return ContainerUtil.newConcurrentMap(ContainerUtil.<SliceNode>identityStrategy());
    }

    @Override
    protected Collection<PsiElement> create(SliceNode key) {
      return ContainerUtil.newConcurrentSet(LEAF_ELEMENT_EQUALITY);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:SliceLeafAnalyzer.java

示例5: getMarkupModelMap

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
private static ConcurrentMap<Project, MarkupModelImpl> getMarkupModelMap(@NotNull Document document) {
  ConcurrentMap<Project, MarkupModelImpl> markupModelMap = document.getUserData(MARKUP_MODEL_MAP_KEY);
  if (markupModelMap == null) {
    ConcurrentMap<Project, MarkupModelImpl> newMap = ContainerUtil.newConcurrentMap();
    markupModelMap = ((UserDataHolderEx)document).putUserDataIfAbsent(MARKUP_MODEL_MAP_KEY, newMap);
  }
  return markupModelMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DocumentMarkupModel.java

示例6: getCachedValue

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public V getCachedValue(T key) {
  SofterReference<ConcurrentMap<T, V>> ref = myCache;
  ConcurrentMap<T, V> map = ref == null ? null : ref.get();
  if (map == null) {
    myCache = new SofterReference<ConcurrentMap<T, V>>(map = ContainerUtil.newConcurrentMap());
  }
  V value = map.get(key);
  if (value == null) {
    map.put(key, value = myValueProvider.fun(key));
  }
  return value;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SofterCache.java

示例7: FactorTree

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public FactorTree(final Project project, GroovyDslExecutor executor) {
  myExecutor = executor;
  myProvider = new CachedValueProvider<Map>() {
    @Nullable
    @Override
    public Result<Map> compute() {
      return new Result<Map>(ContainerUtil.newConcurrentMap(), PsiModificationTracker.MODIFICATION_COUNT,
                             ProjectRootManager.getInstance(project));
    }
  };
  myTopLevelCache = CachedValuesManager.getManager(project).createCachedValue(myProvider, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:FactorTree.java

示例8: getCachedType

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static PsiType getCachedType(String typeText, PsiFile context) {
  Map<String, PsiType> map = context.getUserData(CACHED_TYPES);
  if (map == null) {
    map = ContainerUtil.newConcurrentMap();
    context.putUserData(CACHED_TYPES, map);
  }
  PsiType type = map.get(typeText);
  if (type == null || !type.isValid()) {
    type = JavaPsiFacade.getElementFactory(context.getProject()).createTypeFromText(typeText, context);
    map.put(typeText, type);
  }
  return type;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ClassContextFilter.java

示例9: ExternalSystemRunManagerListener

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public ExternalSystemRunManagerListener(ExternalProjectsManager manager) {
  myManager = manager;
  myMap = ContainerUtil.newConcurrentMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:ExternalSystemRunManagerListener.java

示例10: CachesHolder

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public CachesHolder(final Project project, final RepositoryLocationCache locationCache) {
  myProject = project;
  myLocationCache = locationCache;
  myPlManager = ProjectLevelVcsManager.getInstance(myProject);
  myCacheFiles = ContainerUtil.newConcurrentMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:CachesHolder.java

示例11: CommittedChangesCache

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public CommittedChangesCache(final Project project, final MessageBus bus, final ProjectLevelVcsManager vcsManager) {
  myProject = project;
  myBus = bus;
  myConnection = myBus.connect();
  final VcsListener vcsListener = new VcsListener() {
    @Override
    public void directoryMappingChanged() {
      myLocationCache.reset();
      refreshAllCachesAsync(false, true);
      refreshIncomingChangesAsync();
      myTaskQueue.run(new Runnable() {
        @Override
        public void run() {
          final List<ChangesCacheFile> files = myCachesHolder.getAllCaches();
          for (ChangesCacheFile file : files) {
            final RepositoryLocation location = file.getLocation();
            fireChangesLoaded(location, Collections.<CommittedChangeList>emptyList());
          }
          fireIncomingReloaded();
        }
      });
    }
  };
  myLocationCache = new RepositoryLocationCache(project);
  myCachesHolder = new CachesHolder(project, myLocationCache);
  myTaskQueue = new ProgressManagerQueue(project, VcsBundle.message("committed.changes.refresh.progress"));
  ((ProjectLevelVcsManagerImpl) vcsManager).addInitializationRequest(VcsInitObject.COMMITTED_CHANGES_CACHE, new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
          if (myProject.isDisposed()) return;
          myTaskQueue.start();
          myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, vcsListener);
          myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, vcsListener);
        }
      });
    }
  });
  myVcsManager = vcsManager;
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      cancelRefreshTimer();
      myConnection.disconnect();
    }
  });
  myExternallyLoadedChangeLists = ContainerUtil.newConcurrentMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:CommittedChangesCache.java

示例12: create

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> create() {
  return ContainerUtil.newConcurrentMap();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DomElementsProblemsHolderImpl.java

示例13: compute

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public Result<ConcurrentMap<DeclarationCacheKey, List<DeclarationHolder>>> compute() {
  ConcurrentMap<DeclarationCacheKey, List<DeclarationHolder>> map = ContainerUtil.newConcurrentMap();
  return Result.create(map, PsiModificationTracker.MODIFICATION_COUNT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:DeclarationCacheKey.java

示例14: compute

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
@Override
public Result<ConcurrentMap<String, GrBindingVariable>> compute() {
  final ConcurrentMap<String, GrBindingVariable> map = ContainerUtil.newConcurrentMap();
  return Result.create(map, PsiModificationTracker.MODIFICATION_COUNT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GroovyFileImpl.java


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