Java 类com.intellij.psi.impl.java.stubs.index.JavaStaticMemberTypeIndex 实例源码

项目:intellij-ce-playground    文件:MembersGetter.java   
public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where,
                           final boolean acceptMethods, final boolean searchInheritors) {
  if (where == null || isPrimitiveClass(where)) return;

  final boolean searchFactoryMethods = searchInheritors &&
                                 !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) &&
                                 !isPrimitiveClass(where);

  final Project project = myPlace.getProject();
  final GlobalSearchScope scope = myPlace.getResolveScope();

  final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where);
  Consumer<PsiType> consumer = new Consumer<PsiType>() {
    @Override
    public void consume(PsiType psiType) {
      PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
      if (psiClass == null) {
        return;
      }
      psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
      if (mayProcessMembers(psiClass)) {
        final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
        psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace);
        doProcessMembers(acceptMethods, results, psiType == baseType, declProcessor.getResults());

        String name = psiClass.getName();
        if (name != null && searchFactoryMethods) {
          Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope);
          doProcessMembers(acceptMethods, results, false, factoryMethods);
        }
      }
    }
  };
  consumer.consume(baseType);
  if (searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName())) {
    CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer);
  }
}
项目:tools-idea    文件:MembersGetter.java   
public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where,
                           final boolean acceptMethods, final boolean searchInheritors) {
  if (where == null || CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName())) return;

  final boolean searchFactoryMethods = searchInheritors &&
                                 !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) &&
                                 !CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName());

  final Project project = myPlace.getProject();
  final GlobalSearchScope scope = myPlace.getResolveScope();

  final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where);
  Consumer<PsiType> consumer = new Consumer<PsiType>() {
    @Override
    public void consume(PsiType psiType) {
      PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
      if (psiClass == null) {
        return;
      }
      psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
      if (mayProcessMembers(psiClass)) {
        final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
        psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace);
        doProcessMembers(acceptMethods, results, psiType != baseType, declProcessor.getResults());

        String name = psiClass.getName();
        if (name != null && searchFactoryMethods) {
          Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope);
          doProcessMembers(acceptMethods, results, psiType != baseType, factoryMethods);
        }
      }
    }
  };
  consumer.consume(baseType);
  if (searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName())) {
    CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer);
  }
}
项目:consulo-java    文件:MembersGetter.java   
public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where, final boolean acceptMethods, final boolean searchInheritors)
{
    if(where == null || isPrimitiveClass(where))
    {
        return;
    }

    final boolean searchFactoryMethods = searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) && !isPrimitiveClass(where);

    final Project project = myPlace.getProject();
    final GlobalSearchScope scope = myPlace.getResolveScope();

    final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where);
    Consumer<PsiType> consumer = psiType ->
    {
        PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
        if(psiClass == null)
        {
            return;
        }
        psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
        if(mayProcessMembers(psiClass))
        {
            final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<>(TrueFilter.INSTANCE);
            psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace);
            doProcessMembers(acceptMethods, results, psiType == baseType, declProcessor.getResults());

            String name = psiClass.getName();
            if(name != null && searchFactoryMethods)
            {
                Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope);
                doProcessMembers(acceptMethods, results, false, factoryMethods);
            }
        }
    };
    consumer.consume(baseType);
    if(searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()))
    {
        CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer);
    }
}