本文整理汇总了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;
}
示例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);
}
};
}
示例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;
}
示例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);
}
};
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例9: ExternalSystemRunManagerListener
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public ExternalSystemRunManagerListener(ExternalProjectsManager manager) {
myManager = manager;
myMap = ContainerUtil.newConcurrentMap();
}
示例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();
}
示例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();
}
示例12: create
import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> create() {
return ContainerUtil.newConcurrentMap();
}
示例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);
}
示例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);
}