Java 类com.intellij.psi.util.ParameterizedCachedValueProvider 实例源码

项目:intellij-ce-playground    文件:ProjectFacetManagerImpl.java   
public ProjectFacetManagerImpl(Project project) {
  myProject = project;
  myCachedValueProvider = new ParameterizedCachedValueProvider<Boolean, FacetTypeId<?>>() {
    @Override
    public CachedValueProvider.Result<Boolean> compute(FacetTypeId<?> param) {
      boolean result = false;
      for (Module module : ModuleManager.getInstance(myProject).getModules()) {
        if (!FacetManager.getInstance(module).getFacetsByType(param).isEmpty()) {
          result = true;
          break;
        }
      }
      return CachedValueProvider.Result.create(result, FacetFinder.getInstance(myProject).getAllFacetsOfTypeModificationTracker(param));
    }
  };
}
项目:consulo-xml    文件:RngNsDescriptor.java   
private XmlElementDescriptor findRootDescriptor(final XmlTag tag) {
  return CachedValuesManager.getManager(tag.getProject())
      .getParameterizedCachedValue(tag, ROOT_KEY, new ParameterizedCachedValueProvider<XmlElementDescriptor, RngNsDescriptor>() {
        @Override
        public CachedValueProvider.Result<XmlElementDescriptor> compute(RngNsDescriptor o) {
          final XmlElementDescriptor descr = o.findRootDescriptorInner(tag);
          if (descr != null) {
            return CachedValueProvider.Result.create(descr, tag, descr.getDependences(), o.getDependences());
          }
          else {
            return CachedValueProvider.Result.create(null, tag, o.getDependences());
          }
        }
      }, false, this);
}
项目:consulo-xml    文件:RngElementDescriptor.java   
@Override
public final XmlElementDescriptor getElementDescriptor(final XmlTag childTag, XmlTag contextTag) {
  final XmlElementDescriptor value = getCachedValue(childTag, this, DESCR_KEY, new ParameterizedCachedValueProvider<XmlElementDescriptor, RngElementDescriptor>() {
    @Override
    public CachedValueProvider.Result<XmlElementDescriptor> compute(RngElementDescriptor p) {
      final XmlElementDescriptor descriptor = p.findElementDescriptor(childTag);
      return CachedValueProvider.Result.create(descriptor, p.getDependences(), childTag);
    }
  });
  return value == NULL ? null : value;
}
项目:consulo-xml    文件:RngElementDescriptor.java   
@Override
public final XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag context) {
  if (context != null) {
    return getCachedValue(context, this, ATTRS_KEY, new ParameterizedCachedValueProvider<XmlAttributeDescriptor[], RngElementDescriptor>() {
      @Override
      public CachedValueProvider.Result<XmlAttributeDescriptor[]> compute(RngElementDescriptor p) {
        final XmlAttributeDescriptor[] value = p.collectAttributeDescriptors(context);
        return CachedValueProvider.Result.create(value, p.getDependences(), context);
      }
    });
  } else {
    return collectAttributeDescriptors(null);
  }
}
项目:consulo-javascript    文件:JSClassBase.java   
@Override
protected ParameterizedCachedValue<List<JSClass>, Object> compute(final JSClassBase jsClassBase, final Object p)
{
    return CachedValuesManager.getManager(jsClassBase.getProject()).createParameterizedCachedValue(new
                                                                                                           ParameterizedCachedValueProvider<List<JSClass>, Object>()
    {
        @Override
        public CachedValueProvider.Result<List<JSClass>> compute(Object list)
        {
            return new CachedValueProvider.Result<List<JSClass>>(doCompute(list), PsiModificationTracker.MODIFICATION_COUNT);
        }
    }, false);
}
项目:intellij-ce-playground    文件:PsiParameterizedCachedValue.java   
public PsiParameterizedCachedValue(@NotNull PsiManager manager, @NotNull ParameterizedCachedValueProvider<T, P> provider) {
  super(manager);
  myProvider = provider;
}
项目:intellij-ce-playground    文件:PsiParameterizedCachedValue.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:intellij-ce-playground    文件:ParameterizedCachedValueImpl.java   
public ParameterizedCachedValueImpl(@NotNull ParameterizedCachedValueProvider<T,P> provider) {
  myProvider = provider;
}
项目:intellij-ce-playground    文件:ParameterizedCachedValueImpl.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:tools-idea    文件:PsiParameterizedCachedValue.java   
public PsiParameterizedCachedValue(@NotNull PsiManager manager, @NotNull ParameterizedCachedValueProvider<T, P> provider) {
  super(manager);
  myProvider = provider;
}
项目:tools-idea    文件:PsiParameterizedCachedValue.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:tools-idea    文件:ParameterizedCachedValueImpl.java   
public ParameterizedCachedValueImpl(@NotNull ParameterizedCachedValueProvider<T,P> provider) {
  myProvider = provider;
}
项目:tools-idea    文件:ParameterizedCachedValueImpl.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:consulo    文件:PsiParameterizedCachedValue.java   
public PsiParameterizedCachedValue(@Nonnull PsiManager manager, @Nonnull ParameterizedCachedValueProvider<T, P> provider) {
  super(manager);
  myProvider = provider;
}
项目:consulo    文件:PsiParameterizedCachedValue.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:consulo    文件:ParameterizedCachedValueImpl.java   
public ParameterizedCachedValueImpl(@Nonnull ParameterizedCachedValueProvider<T,P> provider) {
  myProvider = provider;
}
项目:consulo    文件:ParameterizedCachedValueImpl.java   
@Override
public ParameterizedCachedValueProvider<T,P> getValueProvider() {
  return myProvider;
}
项目:consulo-xml    文件:RngElementDescriptor.java   
private static <D extends PsiElement, T, P> T getCachedValue(D context, P p, Key<ParameterizedCachedValue<T, P>> key, ParameterizedCachedValueProvider<T, P> provider) {
  final CachedValuesManager mgr = CachedValuesManager.getManager(context.getProject());
  return mgr.getParameterizedCachedValue(context, key, provider, false, p);
}
项目:consulo-javascript    文件:JSResolveUtil.java   
@Override
protected ParameterizedCachedValue<Set<String>, JSElement> compute(JSElement jsElement, Object p)
{
    return CachedValuesManager.getManager(jsElement.getProject()).createParameterizedCachedValue(new ParameterizedCachedValueProvider<Set<String>, JSElement>()
    {
        @Override
        public CachedValueProvider.Result<Set<String>> compute(JSElement context)
        {
            class MyProcessor extends ResolveProcessor implements Processor<PsiNamedElement>
            {
                Set<String> openedNses;

                public MyProcessor()
                {
                    super(null);
                    putUserData(ResolveProcessor.LOOKING_FOR_USE_NAMESPACES, true);
                }

                @Override
                public boolean process(PsiNamedElement psiNamedElement)
                {
                    if(psiNamedElement instanceof JSElement)
                    {
                        processDeclarationsInScope((JSElement) psiNamedElement, this, ResolveState.initial(), psiNamedElement, psiNamedElement);
                    }
                    else
                    {
                        // TODO: XmlFile ?
                    }
                    return true;
                }

                @Override
                public boolean execute(PsiElement element, ResolveState state)
                {
                    if(!(element instanceof JSUseNamespaceDirective))
                    {
                        return true;
                    }
                    if(openedNses == null)
                    {
                        openedNses = new THashSet<String>();
                    }
                    openedNses.add(((JSUseNamespaceDirective) element).getNamespaceToBeUsed());
                    return true;
                }
            }
            MyProcessor processor = new MyProcessor();
            walkOverStructure(context, processor);
            return new CachedValueProvider.Result<Set<String>>(processor.openedNses, PsiModificationTracker.EVER_CHANGED);
        }
    }, false);
}
项目:intellij-ce-playground    文件:CachedValuesFactory.java   
<T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue);
项目:tools-idea    文件:CachedValuesFactory.java   
<T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@NotNull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue);
项目:consulo    文件:CachedValuesFactory.java   
<T,P> ParameterizedCachedValue<T,P> createParameterizedCachedValue(@Nonnull ParameterizedCachedValueProvider<T,P> provider, boolean trackValue);