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

项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByNameIfNotMoreThan(@NonNls @NotNull final String name, @NotNull final GlobalSearchScope scope, final int maxCount) {
  final List<PsiMethod> methods = new SmartList<PsiMethod>();
  StubIndex.getInstance().processElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(), scope, PsiMethod.class, new
                                          CommonProcessors.CollectProcessor < PsiMethod > (methods){
  @Override
    public boolean process(PsiMethod method) {
      return methods.size() != maxCount && super.process(method);
    }
  });
  if (methods.isEmpty()) return PsiMethod.EMPTY_ARRAY;

  List<PsiMethod> list = filterMembers(methods, scope);
  return list.toArray(new PsiMethod[list.size()]);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiField[] getFieldsByNameIfNotMoreThan(@NotNull String name, @NotNull final GlobalSearchScope scope, final int maxCount) {
  final List<PsiField> methods = new SmartList<PsiField>();
  StubIndex.getInstance().processElements(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), scope, PsiField.class, new
                                          CommonProcessors.CollectProcessor < PsiField > (methods){
  @Override
    public boolean process(PsiField method) {
      return methods.size() != maxCount && super.process(method);
    }
  });
  if (methods.isEmpty()) return PsiField.EMPTY_ARRAY;

  List<PsiField> list = filterMembers(methods, scope);
  return list.toArray(new PsiField[list.size()]);
}
项目:intellij-ce-playground    文件:JavaClassReferenceListElementType.java   
@Override
public void indexStub(@NotNull PsiClassReferenceListStub stub, @NotNull IndexSink sink) {
  PsiReferenceList.Role role = stub.getRole();
  if (role == PsiReferenceList.Role.EXTENDS_LIST || role == PsiReferenceList.Role.IMPLEMENTS_LIST) {
    String[] names = stub.getReferencedNames();
    for (String name : names) {
      String shortName = PsiNameHelper.getShortClassName(name);
      if (!StringUtil.isEmptyOrSpaces(shortName)) {
        sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, shortName);
      }
    }

    if (role == PsiReferenceList.Role.EXTENDS_LIST) {
      StubElement parentStub = stub.getParentStub();
      if (parentStub instanceof PsiClassStub) {
        PsiClassStub psiClassStub = (PsiClassStub)parentStub;
        if (psiClassStub.isEnum()) {
          sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Enum");
        }
        if (psiClassStub.isAnnotationType()) {
          sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Annotation");
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:JavaClassElementType.java   
@Override
public void indexStub(@NotNull final PsiClassStub stub, @NotNull final IndexSink sink) {
  boolean isAnonymous = stub.isAnonymous();
  if (isAnonymous) {
    String baseRef = stub.getBaseClassReferenceText();
    if (baseRef != null) {
      sink.occurrence(JavaStubIndexKeys.ANONYMOUS_BASEREF, PsiNameHelper.getShortClassName(baseRef));
    }
  }
  else {
    final String shortName = stub.getName();
    if (shortName != null) {
      sink.occurrence(JavaStubIndexKeys.CLASS_SHORT_NAMES, shortName);
    }

    final String fqn = stub.getQualifiedName();
    if (fqn != null) {
      sink.occurrence(JavaStubIndexKeys.CLASS_FQN, fqn.hashCode());
    }
  }
}
项目:tools-idea    文件:JavaClassReferenceListElementType.java   
@Override
public void indexStub(@NotNull PsiClassReferenceListStub stub, @NotNull IndexSink sink) {
  PsiReferenceList.Role role = stub.getRole();
  if (role == PsiReferenceList.Role.EXTENDS_LIST || role == PsiReferenceList.Role.IMPLEMENTS_LIST) {
    String[] names = stub.getReferencedNames();
    for (String name : names) {
      String shortName = PsiNameHelper.getShortClassName(name);
      if (!StringUtil.isEmptyOrSpaces(shortName)) {
        sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, shortName);
      }
    }

    if (role == PsiReferenceList.Role.EXTENDS_LIST) {
      StubElement parentStub = stub.getParentStub();
      if (parentStub instanceof PsiClassStub) {
        PsiClassStub psiClassStub = (PsiClassStub)parentStub;
        if (psiClassStub.isEnum()) {
          sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Enum");
        }
        if (psiClassStub.isAnnotationType()) {
          sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Annotation");
        }
      }
    }
  }
}
项目:tools-idea    文件:JavaClassElementType.java   
@Override
public void indexStub(@NotNull final PsiClassStub stub, @NotNull final IndexSink sink) {
  boolean isAnonymous = stub.isAnonymous();
  if (isAnonymous) {
    String baseRef = stub.getBaseClassReferenceText();
    if (baseRef != null) {
      sink.occurrence(JavaStubIndexKeys.ANONYMOUS_BASEREF, PsiNameHelper.getShortClassName(baseRef));
    }
  }
  else {
    final String shortName = stub.getName();
    if (shortName != null) {
      sink.occurrence(JavaStubIndexKeys.CLASS_SHORT_NAMES, shortName);
    }

    final String fqn = stub.getQualifiedName();
    if (fqn != null) {
      sink.occurrence(JavaStubIndexKeys.CLASS_FQN, fqn.hashCode());
    }
  }
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByNameIfNotMoreThan(@NonNls @NotNull final String name, @NotNull final GlobalSearchScope scope, final int maxCount)
{
    final List<PsiMethod> methods = new SmartList<PsiMethod>();
    StubIndex.getInstance().process(JavaStubIndexKeys.METHODS, name, myManager.getProject(), scope,
            new CommonProcessors.CollectProcessor<PsiMethod>(methods)
    {
        @Override
        public boolean process(PsiMethod method)
        {
            return methods.size() != maxCount && super.process(method);
        }
    });
    if(methods.isEmpty())
    {
        return PsiMethod.EMPTY_ARRAY;
    }

    List<PsiMethod> list = filterMembers(methods, scope);
    return list.toArray(new PsiMethod[list.size()]);
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiField[] getFieldsByNameIfNotMoreThan(@NotNull String name, @NotNull final GlobalSearchScope scope, final int maxCount)
{
    final List<PsiField> methods = new SmartList<PsiField>();
    StubIndex.getInstance().process(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), scope,
            new CommonProcessors.CollectProcessor<PsiField>(methods)
    {
        @Override
        public boolean process(PsiField method)
        {
            return methods.size() != maxCount && super.process(method);
        }
    });
    if(methods.isEmpty())
    {
        return PsiField.EMPTY_ARRAY;
    }

    List<PsiField> list = filterMembers(methods, scope);
    return list.toArray(new PsiField[list.size()]);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByName(@NotNull String name, @NotNull final GlobalSearchScope scope) {
  Collection<PsiMethod> methods = StubIndex.getElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(),
                                                        new JavaSourceFilterScope(scope), PsiMethod.class);
  if (methods.isEmpty()) return PsiMethod.EMPTY_ARRAY;

  List<PsiMethod> list = filterMembers(methods, scope);
  return list.toArray(new PsiMethod[list.size()]);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processFieldsWithName(@NotNull String name,
                                     @NotNull Processor<? super PsiField> processor,
                                     @NotNull GlobalSearchScope scope,
                                     @Nullable IdFilter filter) {
  return StubIndex.getInstance().processElements(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), new JavaSourceFilterScope(scope),
                                                 filter, PsiField.class, processor);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processMethodsWithName(@NonNls @NotNull String name,
                                      @NotNull Processor<? super PsiMethod> processor,
                                      @NotNull GlobalSearchScope scope,
                                      @Nullable IdFilter filter) {
  return StubIndex.getInstance().processElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(),
                                                 new JavaSourceFilterScope(scope), filter, PsiMethod.class, processor);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processClassesWithName(@NotNull String name,
                                      @NotNull Processor<? super PsiClass> processor,
                                      @NotNull GlobalSearchScope scope,
                                      @Nullable IdFilter filter) {
  return StubIndex.getInstance().processElements(JavaStubIndexKeys.CLASS_SHORT_NAMES, name, myManager.getProject(),
                                                 new JavaSourceFilterScope(scope), filter, PsiClass.class, processor);
}
项目:intellij-ce-playground    文件:JavaAnnotationElementType.java   
@Override
public void indexStub(@NotNull PsiAnnotationStub stub, @NotNull IndexSink sink) {
  String shortName = getReferenceShortName(stub.getText());
  if (!StringUtil.isEmptyOrSpaces(shortName)) {
    sink.occurrence(JavaStubIndexKeys.ANNOTATIONS, shortName);
  }
}
项目:intellij-ce-playground    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.FIELDS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
    }
  }
}
项目:intellij-ce-playground    文件:GrMethodElementType.java   
@Override
public void indexStub(@NotNull GrMethodStub stub, @NotNull IndexSink sink) {
  String name = stub.getName();
  sink.occurrence(GrMethodNameIndex.KEY, name);
  if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
  }
  for (String annName : stub.getAnnotations()) {
    if (annName != null) {
      sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
    }
  }
}
项目:intellij-ce-playground    文件:GrFieldElementType.java   
static void indexFieldStub(GrFieldStub stub, IndexSink sink) {
  String name = stub.getName();
  sink.occurrence(GrFieldNameIndex.KEY, name);
  if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
  }
  for (String annName : stub.getAnnotations()) {
    if (annName != null) {
      sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
    }
  }
}
项目:robot-intellij-plugin    文件:RobotJavaPsiUtil.java   
public static void findAllJavaKeywordsStartingWithUsingWordIndex(Project project, List<PsiElement> results, String startsWith, boolean wrapPsiMethods) {
    // First process the stub index that has all Java files in the current project
    final StubIndex STUB_INDEX = StubIndex.getInstance();
    GlobalSearchScope javaFiles = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.projectScope(project), JavaFileType.INSTANCE);
    RobotKeywordPsiAnnotationProcessor processor = new RobotKeywordPsiAnnotationProcessor(results, SearchType.STARTS_WITH, Optional.of(startsWith), wrapPsiMethods);
    STUB_INDEX.processElements(JavaStubIndexKeys.ANNOTATIONS, ROBOT_KEYWORD_ANNOTATION_SHORT, project, javaFiles, PsiAnnotation.class, processor);

    // Next, attempt to find Keywords from external sources using the Word Index on the word "RobotKeyword".
    PsiSearchHelper PSI_SEARCH_HELPER = PsiSearchHelper.SERVICE.getInstance(project);
    GlobalSearchScope outsideProjectScope = GlobalSearchScope.allScope(project).intersectWith(GlobalSearchScope.notScope(GlobalSearchScope.projectScope(project)));
    GlobalSearchScope javaOutsideProjectScope = GlobalSearchScope.getScopeRestrictedByFileTypes(outsideProjectScope, JavaFileType.INSTANCE);
    TextOccurenceProcessor textOccurenceProcessor = new RobotAnnotationTextOccurrenceProcessor(results, SearchType.FIND_ALL, Optional.of(startsWith), wrapPsiMethods);
    PSI_SEARCH_HELPER.processElementsWithWord(textOccurenceProcessor, javaOutsideProjectScope, ROBOT_KEYWORD_ANNOTATION_SHORT, UsageSearchContext.IN_CODE, true);
}
项目:robot-intellij-plugin    文件:RobotJavaPsiUtil.java   
@NotNull
public static Optional<PsiMethod> findUniqueJavaKeywordForRobotKeyword(Project project, String robotKeywordName, boolean wrapPsiMethods) {
    //First attempt to find the Java method with the exact name using the Method stub index:
    final String methodName = RobotPsiUtil.robotKeywordToMethodFast(robotKeywordName);
    final String normalizedName = RobotPsiUtil.normalizeKeywordForIndex(robotKeywordName);
    Collection<PsiMethod> methods = StubIndex.getElements(JavaStubIndexKeys.METHODS, methodName, project, GlobalSearchScope.allScope(project), PsiMethod.class);

    for (PsiMethod method : methods) {
        if (!isPsiMethodRobotKeyword(method)) {
            continue;
        }
        String methodNameLower = method.getName().toLowerCase();
        if (methodNameLower.equals(normalizedName)) {
            return Optional.of(wrap(method, wrapPsiMethods));
        }
    }

    GlobalSearchScope javaFilesInProject = GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), JavaFileType.INSTANCE);
    List<PsiElement> results = Lists.newArrayList();

    //If no results are found, attempt to search the words index by the method name (since it is case insensitive, we might get results that we didn't get above.)
    RobotJavaFileProcessor processor = new RobotJavaFileProcessor(results, SearchType.FIRST_EXACT_MATCH, Optional.of(normalizedName), wrapPsiMethods);
    PsiSearchHelper.SERVICE.getInstance(project).processAllFilesWithWord(methodName, javaFilesInProject, processor, false);
    if (results.size() > 0) {
        return Optional.of((PsiMethod)results.get(0));
    }

    //If still no results are found, assume the Java method has the "underscore" style and search with words index again
    final String underscoreMethod = RobotPsiUtil.robotKeywordToUnderscoreStyleMethod(robotKeywordName);
    if (!underscoreMethod.equals(normalizedName)) {
        RobotJavaFileProcessor underscoreProcessor = new RobotJavaFileProcessor(results, SearchType.FIRST_EXACT_MATCH, Optional.of(underscoreMethod), wrapPsiMethods);
        PsiSearchHelper.SERVICE.getInstance(project).processAllFilesWithWord(underscoreMethod, javaFilesInProject, underscoreProcessor, false);
        if (results.size() > 0) {
            return Optional.of((PsiMethod) results.get(0));
        }
    }

    return Optional.absent();
}
项目:tools-idea    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByName(@NotNull String name, @NotNull final GlobalSearchScope scope) {
  Collection<PsiMethod> methods = StubIndex.getInstance().get(JavaStubIndexKeys.METHODS, name, myManager.getProject(), new JavaSourceFilterScope(scope));
  if (methods.isEmpty()) return PsiMethod.EMPTY_ARRAY;

  List<PsiMethod> list = filterMembers(methods, scope);
  return list.toArray(new PsiMethod[list.size()]);
}
项目:tools-idea    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByNameIfNotMoreThan(@NonNls @NotNull final String name, @NotNull final GlobalSearchScope scope, final int maxCount) {
  final List<PsiMethod> methods = new SmartList<PsiMethod>();
  StubIndex.getInstance().process(JavaStubIndexKeys.METHODS, name, myManager.getProject(), scope, new CommonProcessors.CollectProcessor<PsiMethod>(methods){
    @Override
    public boolean process(PsiMethod method) {
      return methods.size() != maxCount && super.process(method);
    }
  });
  if (methods.isEmpty()) return PsiMethod.EMPTY_ARRAY;

  List<PsiMethod> list = filterMembers(methods, scope);
  return list.toArray(new PsiMethod[list.size()]);
}
项目:tools-idea    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiField[] getFieldsByNameIfNotMoreThan(@NotNull String name, @NotNull final GlobalSearchScope scope, final int maxCount) {
  final List<PsiField> methods = new SmartList<PsiField>();
  StubIndex.getInstance().process(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), scope, new CommonProcessors.CollectProcessor<PsiField>(methods){
    @Override
    public boolean process(PsiField method) {
      return methods.size() != maxCount && super.process(method);
    }
  });
  if (methods.isEmpty()) return PsiField.EMPTY_ARRAY;

  List<PsiField> list = filterMembers(methods, scope);
  return list.toArray(new PsiField[list.size()]);
}
项目:tools-idea    文件:JavaMethodElementType.java   
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.METHODS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
    }
  }
}
项目:tools-idea    文件:JavaAnnotationElementType.java   
@Override
public void indexStub(@NotNull PsiAnnotationStub stub, @NotNull IndexSink sink) {
  String shortName = getReferenceShortName(stub.getText());
  if (!StringUtil.isEmptyOrSpaces(shortName)) {
    sink.occurrence(JavaStubIndexKeys.ANNOTATIONS, shortName);
  }
}
项目:tools-idea    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.FIELDS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
    }
  }
}
项目:tools-idea    文件:GrMethodElementType.java   
public void indexStub(@NotNull GrMethodStub stub, @NotNull IndexSink sink) {
  String name = stub.getName();
  sink.occurrence(GrMethodNameIndex.KEY, name);
  if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
  }
  for (String annName : stub.getAnnotations()) {
    if (annName != null) {
      sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
    }
  }
}
项目:tools-idea    文件:GrFieldElementType.java   
static void indexFieldStub(GrFieldStub stub, IndexSink sink) {
  String name = stub.getName();
  sink.occurrence(GrFieldNameIndex.KEY, name);
  if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
    sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
  }
  for (String annName : stub.getAnnotations()) {
    if (annName != null) {
      sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
    }
  }
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
@NotNull
public PsiMethod[] getMethodsByName(@NotNull String name, @NotNull final GlobalSearchScope scope)
{
    Collection<PsiMethod> methods = StubIndex.getElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(),
            new JavaSourceFilterScope(scope), PsiMethod.class);
    if(methods.isEmpty())
    {
        return PsiMethod.EMPTY_ARRAY;
    }

    List<PsiMethod> list = filterMembers(methods, scope);
    return list.toArray(new PsiMethod[list.size()]);
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processFieldsWithName(@NotNull String name, @NotNull Processor<? super PsiField> processor, @NotNull GlobalSearchScope scope,
        @Nullable IdFilter filter)
{
    return StubIndex.getInstance().process(JavaStubIndexKeys.FIELDS, name, myManager.getProject(), new JavaSourceFilterScope(scope), filter,
            processor);
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processMethodsWithName(@NonNls @NotNull String name, @NotNull Processor<? super PsiMethod> processor,
        @NotNull GlobalSearchScope scope, @Nullable IdFilter filter)
{
    return StubIndex.getInstance().process(JavaStubIndexKeys.METHODS, name, myManager.getProject(), new JavaSourceFilterScope(scope), filter,
            processor);
}
项目:consulo-java    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processClassesWithName(@NotNull String name, @NotNull Processor<? super PsiClass> processor, @NotNull GlobalSearchScope scope,
        @Nullable IdFilter filter)
{
    return StubIndex.getInstance().process(JavaStubIndexKeys.CLASS_SHORT_NAMES, name, myManager.getProject(), new JavaSourceFilterScope(scope),
            filter, processor);
}
项目:consulo-java    文件:JavaAnnotationElementType.java   
@Override
public void indexStub(@NotNull PsiAnnotationStub stub, @NotNull IndexSink sink) {
  String shortName = getReferenceShortName(stub.getText());
  if (!StringUtil.isEmptyOrSpaces(shortName)) {
    sink.occurrence(JavaStubIndexKeys.ANNOTATIONS, shortName);
  }
}
项目:consulo-java    文件:JavaFieldStubElementType.java   
@Override
public void indexStub(@NotNull final PsiFieldStub stub, @NotNull final IndexSink sink)
{
    final String name = stub.getName();
    if(name != null)
    {
        sink.occurrence(JavaStubIndexKeys.FIELDS, name);
        if(RecordUtil.isStaticNonPrivateMember(stub))
        {
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
            sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
        }
    }
}
项目:consulo-java    文件:JavaClassReferenceListElementType.java   
@Override
public void indexStub(@NotNull PsiClassReferenceListStub stub, @NotNull IndexSink sink)
{
    PsiReferenceList.Role role = stub.getRole();
    if(role == PsiReferenceList.Role.EXTENDS_LIST || role == PsiReferenceList.Role.IMPLEMENTS_LIST)
    {
        String[] names = stub.getReferencedNames();
        for(String name : names)
        {
            String shortName = PsiNameHelper.getShortClassName(name);
            if(!StringUtil.isEmptyOrSpaces(shortName))
            {
                sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, shortName);
            }
        }

        if(role == PsiReferenceList.Role.EXTENDS_LIST)
        {
            StubElement parentStub = stub.getParentStub();
            if(parentStub instanceof PsiClassStub)
            {
                PsiClassStub psiClassStub = (PsiClassStub) parentStub;
                if(psiClassStub.isEnum())
                {
                    sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Enum");
                }
                if(psiClassStub.isAnnotationType())
                {
                    sink.occurrence(JavaStubIndexKeys.SUPER_CLASSES, "Annotation");
                }
            }
        }
    }
}
项目:consulo-java    文件:JavaClassElementType.java   
@Override
public void indexStub(@NotNull PsiClassStub stub, @NotNull IndexSink sink)
{
    boolean isAnonymous = stub.isAnonymous();
    if(isAnonymous)
    {
        String baseRef = stub.getBaseClassReferenceText();
        if(baseRef != null)
        {
            sink.occurrence(JavaStubIndexKeys.ANONYMOUS_BASEREF, PsiNameHelper.getShortClassName(baseRef));
        }
    }
    else
    {
        final String shortName = stub.getName();
        if(shortName != null)
        {
            sink.occurrence(JavaStubIndexKeys.CLASS_SHORT_NAMES, shortName);
        }

        final String fqn = stub.getQualifiedName();
        if(fqn != null)
        {
            sink.occurrence(JavaStubIndexKeys.CLASS_FQN, fqn.hashCode());
        }
    }
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processAllClassNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
  return StubIndex.getInstance().processAllKeys(JavaStubIndexKeys.CLASS_SHORT_NAMES, processor, scope, filter);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processAllMethodNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
  return StubIndex.getInstance().processAllKeys(JavaStubIndexKeys.METHODS, processor, scope, filter);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processAllFieldNames(Processor<String> processor, GlobalSearchScope scope, IdFilter filter) {
  return StubIndex.getInstance().processAllKeys(JavaStubIndexKeys.FIELDS, processor, scope, filter);
}
项目:intellij-ce-playground    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processMethodsWithName(@NonNls @NotNull String name,
                                      @NotNull GlobalSearchScope scope,
                                      @NotNull Processor<PsiMethod> processor) {
  return StubIndex.getInstance().processElements(JavaStubIndexKeys.METHODS, name, myManager.getProject(), scope, PsiMethod.class, processor);
}
项目:intellij-ce-playground    文件:JavaMethodElementType.java   
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink) {
  final String name = stub.getName();
  if (name != null) {
    sink.occurrence(JavaStubIndexKeys.METHODS, name);
    if (RecordUtil.isStaticNonPrivateMember(stub)) {
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
      sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
    }
  }

  Set<String> methodTypeParams = null;
  for (StubElement stubElement : stub.getChildrenStubs()) {
    if (stubElement instanceof PsiTypeParameterListStub) {
      for (Object tStub : stubElement.getChildrenStubs()) {
        if (tStub instanceof PsiTypeParameterStub) {
          if (methodTypeParams == null) {
            methodTypeParams = new HashSet<String>();
          }
          methodTypeParams.add(((PsiTypeParameterStub)tStub).getName());
        }
      }
    }
    else if (stubElement instanceof PsiParameterListStub) {
      for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
        if (paramStub instanceof PsiParameterStub) {
          TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
          if (type.arrayCount > 0) continue;
          String typeName = type.getShortTypeText();
          if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
          sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
          if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
            sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, TYPE_PARAMETER_PSEUDO_NAME);
            methodTypeParams = null;
          }
        }
      }
      break;
    }
  }
}
项目:tools-idea    文件:PsiShortNamesCacheImpl.java   
@Override
public boolean processMethodsWithName(@NonNls @NotNull String name,
                                      @NotNull GlobalSearchScope scope,
                                      @NotNull Processor<PsiMethod> processor) {
  return StubIndex.getInstance().process(JavaStubIndexKeys.METHODS, name, myManager.getProject(), scope, processor);
}