本文整理汇总了Java中com.intellij.util.containers.ConcurrentFactoryMap类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentFactoryMap类的具体用法?Java ConcurrentFactoryMap怎么用?Java ConcurrentFactoryMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentFactoryMap类属于com.intellij.util.containers包,在下文中一共展示了ConcurrentFactoryMap类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: PsiReferenceRegistrarImpl
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public PsiReferenceRegistrarImpl(final Language language) {
myBindingCache = new ConcurrentFactoryMap<Class, ProviderBinding[]>() {
@Nullable
@Override
protected ProviderBinding[] create(Class key) {
List<ProviderBinding> result = ContainerUtil.newSmartList();
for (Class<?> bindingClass : myBindingsMap.keySet()) {
if (bindingClass.isAssignableFrom(key)) {
result.add(myBindingsMap.get(bindingClass));
}
}
for (Class<?> bindingClass : myNamedBindingsMap.keySet()) {
if (bindingClass.isAssignableFrom(key)) {
result.add(myNamedBindingsMap.get(bindingClass));
}
}
if (language != Language.ANY) {
final PsiReferenceRegistrar anyRegistrar = ReferenceProvidersRegistry.getInstance().getRegistrar(Language.ANY);
Collections.addAll(result, ((PsiReferenceRegistrarImpl)anyRegistrar).myBindingCache.get(key));
}
//noinspection unchecked
return result.toArray(new ProviderBinding[result.size()]);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PsiReferenceRegistrarImpl.java
示例2: ExternalProjectDataService
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的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: ResolveScopeManagerImpl
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public ResolveScopeManagerImpl(Project project, ProjectRootManager projectRootManager, PsiManager psiManager) {
myProject = project;
myProjectRootManager = projectRootManager;
myManager = psiManager;
myDefaultResolveScopesCache = ConcurrentFactoryMap.createMap((key) -> {
GlobalSearchScope scope = null;
for (ResolveScopeProvider resolveScopeProvider : ResolveScopeProvider.EP_NAME.getExtensions()) {
scope = resolveScopeProvider.getResolveScope(key, myProject);
if (scope != null) break;
}
if (scope == null) scope = getInherentResolveScope(key);
for (ResolveScopeEnlarger enlarger : ResolveScopeEnlarger.EP_NAME.getExtensions()) {
final SearchScope extra = enlarger.getAdditionalResolveScope(key, myProject);
if (extra != null) {
scope = scope.union(extra);
}
}
return scope;
});
((PsiManagerImpl)psiManager).registerRunnableToRunOnChange(myDefaultResolveScopesCache::clear);
}
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:ResolveScopeManagerImpl.java
示例4: getAnnotationTypesWithChildren
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public static Collection<PsiClass> getAnnotationTypesWithChildren(@NotNull Module module, String annotationName, boolean includeTests)
{
Project project = module.getProject();
Map<Pair<String, Boolean>, Collection<PsiClass>> map = CachedValuesManager.getManager(project).getCachedValue(module, () ->
{
Map<Pair<String, Boolean>, Collection<PsiClass>> factoryMap = ConcurrentFactoryMap.createMap(key ->
{
GlobalSearchScope moduleScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, key.getSecond());
PsiClass annotationClass = JavaPsiFacade.getInstance(project).findClass(key.getFirst(), moduleScope);
if(annotationClass == null || !annotationClass.isAnnotationType())
{
return Collections.emptyList();
}
// limit search to files containing annotations
GlobalSearchScope effectiveSearchScope = getAllAnnotationFilesScope(project).intersectWith(moduleScope);
return getAnnotationTypesWithChildren(annotationClass, effectiveSearchScope);
});
return CachedValueProvider.Result.create(factoryMap, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
return map.get(pair(annotationName, includeTests));
}
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:MetaAnnotationUtil.java
示例5: findOwnAnnotation
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
private static PsiAnnotation findOwnAnnotation(final PsiModifierListOwner listOwner, Collection<String> annotationNames)
{
Map<Collection<String>, PsiAnnotation> map = CachedValuesManager.getCachedValue(listOwner, () ->
{
Map<Collection<String>, PsiAnnotation> value = ConcurrentFactoryMap.createMap(annotationNames1 ->
{
final PsiModifierList list = listOwner.getModifierList();
if(list == null)
{
return null;
}
for(PsiAnnotation annotation : list.getAnnotations())
{
if(annotationNames1.contains(annotation.getQualifiedName()))
{
return annotation;
}
}
return null;
});
return CachedValueProvider.Result.create(value, PsiModificationTracker.MODIFICATION_COUNT);
});
return map.get(annotationNames);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:25,代码来源:AnnotationUtil.java
示例6: createContractAnnotation
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public PsiAnnotation createContractAnnotation(String contractValue)
{
Map<String, PsiAnnotation> cache = CachedValuesManager.getManager(myProject).getCachedValue(myProject, new CachedValueProvider<Map<String, PsiAnnotation>>()
{
@Nullable
@Override
public Result<Map<String, PsiAnnotation>> compute()
{
Map<String, PsiAnnotation> map = new ConcurrentFactoryMap<String, PsiAnnotation>()
{
@Nullable
@Override
protected PsiAnnotation create(String attrs)
{
return createAnnotationFromText("@org.jetbrains.annotations.Contract(" + attrs + ")");
}
};
return CachedValueProvider.Result.create(map, ModificationTracker.NEVER_CHANGED);
}
});
return cache.get(contractValue);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ProjectBytecodeAnalysis.java
示例7: getAnnotationTypesWithChildren
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public static Collection<PsiClass> getAnnotationTypesWithChildren(@NotNull final Module module, final String annotationName, final boolean includeTests)
{
final Project project = module.getProject();
Map<Pair<String, Boolean>, Collection<PsiClass>> map = CachedValuesManager.getManager(project).getCachedValue(module, () ->
{
Map<Pair<String, Boolean>, Collection<PsiClass>> factoryMap = ConcurrentFactoryMap.createMap(key ->
{
GlobalSearchScope moduleScope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module, key.getSecond());
PsiClass annotationClass = JavaPsiFacade.getInstance(project).findClass(key.getFirst(), moduleScope);
if(annotationClass == null || !annotationClass.isAnnotationType())
{
return Collections.emptyList();
}
// limit search to files containing annotations
GlobalSearchScope effectiveSearchScope = getAllAnnotationFilesScope(project).intersectWith(moduleScope);
return getAnnotationTypesWithChildren(annotationClass, effectiveSearchScope);
});
return CachedValueProvider.Result.create(factoryMap, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
return map.get(Pair.create(annotationName, includeTests));
}
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:MetaAnnotationUtil.java
示例8: compute
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Override
public CachedValueProvider.Result<Map<GlobalSearchScope, MembersMap>> compute(@NotNull final PsiClass myClass) {
final Map<GlobalSearchScope, MembersMap> map = new ConcurrentFactoryMap<GlobalSearchScope, MembersMap>() {
@Nullable
@Override
protected MembersMap create(GlobalSearchScope resolveScope) {
return new MembersMap(myClass, resolveScope);
}
};
return CachedValueProvider.Result.create(map, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiClassImplUtil.java
示例9: fun
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Override
public FactoryMap<String, Map<MethodSignature, HierarchicalMethodSignature>> fun(final PsiClass psiClass) {
return new ConcurrentFactoryMap<String, Map<MethodSignature, HierarchicalMethodSignature>>() {
@Nullable
@Override
protected Map<MethodSignature, HierarchicalMethodSignature> create(String methodName) {
return buildMethodHierarchy(psiClass, methodName, PsiSubstitutor.EMPTY, true, new THashSet<PsiClass>(), false, psiClass.getResolveScope());
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiSuperMethodImplUtil.java
示例10: create
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Override
protected ConcurrentFactoryMap<Class, Boolean> create(final Class anc) {
return new ConcurrentFactoryMap<Class, Boolean>() {
@Override
protected Boolean create(Class desc) {
return anc.isAssignableFrom(desc);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ReflectionAssignabilityCache.java
示例11: create
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Override
protected Map<Class, Object> create(final JavaMethod method) {
return new ConcurrentFactoryMap<Class, Object>() {
@Override
protected Object create(Class annoClass) {
return method.getAnnotation(annoClass);
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:InvocationCache.java
示例12: compute
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
public Result<FactoryMap<File, String>> compute() {
final FactoryMap<File, String> result = new ConcurrentFactoryMap<File, String>() {
@Override
protected String create(File scriptFile) {
return calcClassName(scriptFile);
}
};
return Result.create(result, ProjectRootManager.getInstance(myModule.getProject()));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GradlePositionManager.java
示例13: GdkMethodHolder
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
private GdkMethodHolder(final PsiClass categoryClass, final boolean isStatic, final GlobalSearchScope scope) {
myStatic = isStatic;
myScope = scope;
final MultiMap<String, PsiMethod> byName = new MultiMap<String, PsiMethod>();
myPsiManager = categoryClass.getManager();
for (PsiMethod m : categoryClass.getMethods()) {
final PsiParameter[] params = m.getParameterList().getParameters();
if (params.length == 0) continue;
if (PsiUtil.isDGMMethod(m) && (PsiImplUtil.isDeprecatedByAnnotation(m) || PsiImplUtil.isDeprecatedByDocTag(m))) {
continue;
}
byName.putValue(m.getName(), m);
}
this.myOriginalMethodByType = new VolatileNotNullLazyValue<MultiMap<String, PsiMethod>>() {
@NotNull
@Override
protected MultiMap<String, PsiMethod> compute() {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.values()) {
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) continue;
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
myOriginalMethodsByNameAndType = new ConcurrentFactoryMap<String, MultiMap<String, PsiMethod>>() {
@Override
protected MultiMap<String, PsiMethod> create(String name) {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.get(name)) {
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:GdkMethodHolder.java
示例14: GdkMethodHolder
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
private GdkMethodHolder(final PsiClass categoryClass, final boolean isStatic, final GlobalSearchScope scope) {
myStatic = isStatic;
myScope = scope;
final MultiMap<String, PsiMethod> byName = new MultiMap<String, PsiMethod>();
myPsiManager = categoryClass.getManager();
for (PsiMethod m : categoryClass.getMethods()) {
final PsiParameter[] params = m.getParameterList().getParameters();
if (params.length == 0) continue;
byName.putValue(m.getName(), m);
}
this.myOriginalMethodByType = new VolatileNotNullLazyValue<MultiMap<String, PsiMethod>>() {
@NotNull
@Override
protected MultiMap<String, PsiMethod> compute() {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.values()) {
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) continue;
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
myOriginalMethodsByNameAndType = new ConcurrentFactoryMap<String, MultiMap<String, PsiMethod>>() {
@Override
protected MultiMap<String, PsiMethod> create(String name) {
MultiMap<String, PsiMethod> map = new MultiMap<String, PsiMethod>();
for (PsiMethod method : byName.get(name)) {
map.putValue(getCategoryTargetType(method).getCanonicalText(), method);
}
return map;
}
};
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:GdkMethodHolder.java
示例15: insertDummyIdentifierWithCache
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
private static OffsetsInFile insertDummyIdentifierWithCache(PsiFile file, int startOffset, int endOffset, String replacement) {
ProperTextRange editRange = ProperTextRange.create(startOffset, endOffset);
assertRangeWithinDocument(editRange, file.getViewProvider().getDocument());
ConcurrentFactoryMap<Pair<ProperTextRange, String>, OffsetsInFile> map = CachedValuesManager.getCachedValue(file, () ->
CachedValueProvider.Result.create(
ConcurrentFactoryMap.createConcurrentMap(
key -> copyWithDummyIdentifier(new OffsetsInFile(file), key.first.getStartOffset(), key.first.getEndOffset(), key.second)),
file, file.getViewProvider().getDocument()));
return map.get(Pair.create(editRange, replacement));
}
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:TemplateManagerImpl.java
示例16: metaAnnotationCached
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Nullable
private static PsiAnnotation metaAnnotationCached(PsiClass subjectAnnotation, String annotationToFind)
{
return CachedValuesManager.getCachedValue(subjectAnnotation, () ->
{
ConcurrentMap<String, PsiAnnotation> metaAnnotationsMap = ConcurrentFactoryMap.createMap(anno -> findMetaAnnotation(subjectAnnotation, anno, new HashSet<>()));
return new CachedValueProvider.Result<>(metaAnnotationsMap, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}).get(annotationToFind);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:MetaAnnotationUtil.java
示例17: compute
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Override
public CachedValueProvider.Result<Map<GlobalSearchScope, MembersMap>> compute(@NotNull final PsiClass myClass)
{
final Map<GlobalSearchScope, MembersMap> map = new ConcurrentFactoryMap<GlobalSearchScope, MembersMap>()
{
@Nullable
@Override
protected MembersMap create(GlobalSearchScope resolveScope)
{
return new MembersMap(myClass, resolveScope);
}
};
return CachedValueProvider.Result.create(map, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:15,代码来源:PsiClassImplUtil.java
示例18: findAnnotationInHierarchy
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Nullable
public static PsiAnnotation findAnnotationInHierarchy(@NotNull final PsiModifierListOwner listOwner, @NotNull Set<String> annotationNames)
{
PsiAnnotation directAnnotation = findAnnotation(listOwner, annotationNames);
if(directAnnotation != null)
{
return directAnnotation;
}
Map<Set<String>, PsiAnnotation> map = CachedValuesManager.getCachedValue(listOwner, () ->
{
Map<Set<String>, PsiAnnotation> value = ConcurrentFactoryMap.createMap(annotationNames1 ->
{
for(PsiModifierListOwner superOwner : getSuperAnnotationOwners(listOwner))
{
PsiAnnotation annotation = findAnnotation(superOwner, annotationNames1);
if(annotation != null)
{
return annotation;
}
}
return null;
});
return CachedValueProvider.Result.create(value, PsiModificationTracker.MODIFICATION_COUNT);
});
return map.get(annotationNames);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:28,代码来源:AnnotationUtil.java
示例19: metaAnnotationCached
import com.intellij.util.containers.ConcurrentFactoryMap; //导入依赖的package包/类
@Nullable
private static PsiAnnotation metaAnnotationCached(PsiClass subjectAnnotation, String annotationToFind)
{
ConcurrentMap<String, PsiAnnotation> cachedValue = CachedValuesManager.getCachedValue(subjectAnnotation, () ->
{
ConcurrentMap<String, PsiAnnotation> metaAnnotationsMap = ConcurrentFactoryMap.createMap(anno -> findMetaAnnotation(subjectAnnotation, anno, new HashSet<>()));
return new CachedValueProvider.Result<>(metaAnnotationsMap, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
});
return cachedValue.get(annotationToFind);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:MetaAnnotationUtil.java
注:本文中的com.intellij.util.containers.ConcurrentFactoryMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论