Java 类com.intellij.psi.scope.NameHint 实例源码

项目:intellij-ce-playground    文件:PsiClassImplUtil.java   
private static boolean processDeclarationsInClass(@NotNull PsiClass aClass,
                                                  @NotNull final PsiScopeProcessor processor,
                                                  @NotNull ResolveState state,
                                                  @Nullable Set<PsiClass> visited,
                                                  PsiElement last,
                                                  @NotNull PsiElement place,
                                                  @NotNull LanguageLevel languageLevel,
                                                  boolean isRaw,
                                                  @NotNull GlobalSearchScope resolveScope) {
  if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList) {
    return true; //TypeParameterList and ModifierList do not see our declarations
  }
  if (visited != null && visited.contains(aClass)) return true;

  PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
  isRaw = isRaw || PsiUtil.isRawSubstitutor(aClass, substitutor);

  final NameHint nameHint = processor.getHint(NameHint.KEY);
  if (nameHint != null) {
    String name = nameHint.getName(state);
    return processCachedMembersByName(aClass, processor, state, visited, last, place, isRaw, substitutor,
                                      getValues(aClass).getValue(aClass).get(resolveScope), name,languageLevel);
  }
  return processDeclarationsInClassNotCached(aClass, processor, state, visited, last, place, isRaw, languageLevel, resolveScope);
}
项目:intellij-ce-playground    文件:JavaDummyHolder.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
  if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    final String name = nameHint != null ? nameHint.getName(state) : null;
    //"pseudo-imports"
    if (name != null) {
      PsiClass imported = myPseudoImports.get(name);
      if (imported != null) {
        if (!processor.execute(imported, state)) return false;
      }
    } else {
      for (PsiClass aClass : myPseudoImports.values()) {
        if (!processor.execute(aClass, state)) return false;
      }
    }

    if (myContext == null) {
      if (!JavaResolveUtil.processImplicitlyImportedPackages(processor, state, place, getManager())) return false;
    }
  }
  return true;
}
项目:intellij-ce-playground    文件:GdkMethodHolder.java   
public boolean processMethods(PsiScopeProcessor processor, @NotNull ResolveState state, PsiType qualifierType, Project project) {
  if (qualifierType == null) return true;

  NameHint nameHint = processor.getHint(NameHint.KEY);
  String name = nameHint == null ? null : nameHint.getName(state);
  final MultiMap<String, PsiMethod> map = name != null ? myOriginalMethodsByNameAndType.get(name) : myOriginalMethodByType.getValue();
  if (map.isEmpty()) {
    return true;
  }

  for (String superType : ResolveUtil.getAllSuperTypes(qualifierType, project)) {
    for (PsiMethod method : map.get(superType)) {
      String info = GdkMethodUtil.generateOriginInfo(method);
      GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, info);
      if (!processor.execute(gdk, state)) {
        return false;
      }
    }
  }

  return true;
}
项目:intellij-ce-playground    文件:GrImportStatementImpl.java   
private boolean processDeclarationsForSingleElement(@NotNull PsiScopeProcessor processor,
                                                    @Nullable PsiElement lastParent,
                                                    @NotNull PsiElement place,
                                                    @NotNull ResolveState state) {
  String name = getImportedName();
  if (name == null) return true;

  if (isStatic()) {
    return processSingleStaticImport(processor, state, name, lastParent, place);
  }

  NameHint nameHint = processor.getHint(NameHint.KEY);
  if (nameHint == null || name.equals(nameHint.getName(state))) {
    return processSingleClassImport(processor, state);
  }
  return true;
}
项目:intellij-ce-playground    文件:GrEnumTypeDefinitionImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   @Nullable PsiElement lastParent,
                                   @NotNull PsiElement place) {
  if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    final String name = nameHint == null ? null : nameHint.getName(state);
    for (PsiMethod method : getDefEnumMethods()) {
      if (name == null || name.equals(method.getName())) {
        if (!processor.execute(method, state)) return false;
      }
    }
  }

  return super.processDeclarations(processor, state, lastParent, place);
}
项目:tools-idea    文件:JavaDummyHolder.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
  if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    final String name = nameHint != null ? nameHint.getName(state) : null;
    //"pseudo-imports"
    if (name != null) {
      PsiClass imported = myPseudoImports.get(name);
      if (imported != null) {
        if (!processor.execute(imported, state)) return false;
      }
    } else {
      for (PsiClass aClass : myPseudoImports.values()) {
        if (!processor.execute(aClass, state)) return false;
      }
    }

    if (myContext == null) {
      if (!JavaResolveUtil.processImplicitlyImportedPackages(processor, state, place, getManager())) return false;
    }
  }
  return true;
}
项目:tools-idea    文件:GdkMethodHolder.java   
public boolean processMethods(PsiScopeProcessor processor, ResolveState state, PsiType qualifierType, Project project) {
  if (qualifierType == null) return true;

  NameHint nameHint = processor.getHint(NameHint.KEY);
  String name = nameHint == null ? null : nameHint.getName(state);
  final MultiMap<String, PsiMethod> map = name != null ? myOriginalMethodsByNameAndType.get(name) : myOriginalMethodByType.getValue();
  if (map.isEmpty()) {
    return true;
  }

  for (String superType : ResolveUtil.getAllSuperTypes(qualifierType, project).keySet()) {
    for (PsiMethod method : map.get(superType)) {
      String info = GdkMethodUtil.generateOriginInfo(method);
      GrGdkMethod gdk = GrGdkMethodImpl.createGdkMethod(method, myStatic, info);
      if (!processor.execute(gdk, state)) {
        return false;
      }
    }
  }

  return true;
}
项目:tools-idea    文件:GrImportStatementImpl.java   
private boolean processDeclarationsForSingleElement(PsiScopeProcessor processor, ResolveState state) {
  String name = getImportedName();
  if (name == null) return true;

  NameHint nameHint = processor.getHint(NameHint.KEY);

  GrCodeReferenceElement ref = getImportReference();
  if (ref == null) return true;

  if (isStatic()) {
    return processSingleStaticImport(processor, state, name, nameHint, ref);
  }
  if (nameHint == null || name.equals(nameHint.getName(state))) {
    return processSingleClassImport(processor, state, ref);
  }
  return true;
}
项目:tools-idea    文件:GrEnumTypeDefinitionImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   @Nullable PsiElement lastParent,
                                   @NotNull PsiElement place) {
  ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    final String name = nameHint == null ? null : nameHint.getName(state);
    for (PsiMethod method : getDefEnumMethods()) {
      if (name == null || name.equals(method.getName())) {
        if (!processor.execute(method, state)) return false;
      }
    }
  }

  return super.processDeclarations(processor, state, lastParent, place);
}
项目:intellij-ce-playground    文件:ConflictFilterProcessor.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (hintKey == NameHint.KEY) {
    //noinspection unchecked
    return myName != null ? (T)this : null;
  }
  return super.getHint(hintKey);
}
项目:intellij-ce-playground    文件:MethodResolveProcessor.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (hintKey == ElementClassHint.KEY) {
    return (T)this;
  }
  if (hintKey == NameHint.KEY && myNameHint != null) {
    return (T)this;
  }
  return null;
}
项目:intellij-ce-playground    文件:StaticImportResolveProcessor.java   
@Override
public <T> T getHint(@NotNull final Key<T> hintKey) {
  if (hintKey == NameHint.KEY) {
    //noinspection unchecked
    return (T)this;
  }
  return super.getHint(hintKey);
}
项目:intellij-ce-playground    文件:PsiCodeBlockImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
  if (lastParent == null) {
    // Parent element should not see our vars
    return true;
  }
  Couple<Set<String>> pair = buildMaps();
  boolean conflict = pair == null;
  final Set<String> classesSet = conflict ? null : pair.getFirst();
  final Set<String> variablesSet = conflict ? null : pair.getSecond();
  final NameHint hint = processor.getHint(NameHint.KEY);
  if (hint != null && !conflict) {
    final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
    final String name = hint.getName(state);
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
  }
  else {
    return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
  }
  return true;
}
项目:intellij-ce-playground    文件:ResolveUtil.java   
static PsiScopeProcessor substituteProcessor(PsiScopeProcessor processor, PsiElement scope) {
  //hack for walking up in java code
  //java's processDeclarations don't check names so we should do it manually
  if (scope.getLanguage() != GroovyLanguage.INSTANCE && processor.getHint(NameHint.KEY) != null) {
    return new JavaResolverProcessor(processor);
  }
  return processor;
}
项目:intellij-ce-playground    文件:ResolveUtil.java   
@Nullable
public static String getNameHint(PsiScopeProcessor processor) {
  NameHint nameHint = processor.getHint(NameHint.KEY);
  if (nameHint == null) {
    return null;
  }

  return nameHint.getName(ResolveState.initial());
}
项目:intellij-ce-playground    文件:ResolveUtil.java   
public static boolean processElement(@NotNull PsiScopeProcessor processor,
                                     @NotNull PsiNamedElement namedElement,
                                     @NotNull ResolveState state) {
  NameHint nameHint = processor.getHint(NameHint.KEY);
  String name = nameHint == null ? null : nameHint.getName(state);
  if (name == null || name.equals(namedElement.getName())) {
    return processor.execute(namedElement, state);
  }

  return true;
}
项目:intellij-ce-playground    文件:GrScopeProcessorWithHints.java   
@Override
@SuppressWarnings({"unchecked"})
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (NameHint.KEY == hintKey && myName != null) {
    return (T)this;
  }

  if ((ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) && myResolveTargetKinds != null) {
    return (T)this;
  }

  return null;
}
项目:intellij-ce-playground    文件:GroovyConstructorNamedArgumentProvider.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
  if ((NameHint.KEY == hintKey && myNameHint != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
    //noinspection unchecked
    return (T) this;
  }

  return null;
}
项目:intellij-ce-playground    文件:GrImportStatementImpl.java   
private boolean processSingleStaticImport(@NotNull final PsiScopeProcessor processor,
                                          @NotNull ResolveState state,
                                          @NotNull String importedName,
                                          @Nullable PsiElement lastParent,
                                          @NotNull PsiElement place) {
  final GrCodeReferenceElement ref = getImportReference();
  if (ref == null) return true;

  PsiClass clazz = resolveQualifier();
  if (clazz == null) return true;

  state = state.put(ClassHint.RESOLVE_CONTEXT, this);

  final String refName = ref.getReferenceName();

  final NameHint nameHint = processor.getHint(NameHint.KEY);
  final String hintName = nameHint == null ? null : nameHint.getName(state);

  if (hintName == null || importedName.equals(hintName)) {
    if (!clazz.processDeclarations(new GrDelegatingScopeProcessorWithHints(processor, refName, null), state, lastParent, place)) {
      return false;
    }
  }

  if (ResolveUtil.shouldProcessMethods(processor.getHint(ClassHint.KEY))) {
    if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameByGetterName(hintName, true))) {
      if (!clazz.processDeclarations(new StaticGetterProcessor(refName, processor), state, lastParent, place)) {
        return false;
      }
    }

    if (hintName == null || importedName.equals(GroovyPropertyUtils.getPropertyNameBySetterName(hintName))) {
      if (!clazz.processDeclarations(new StaticSetterProcessor(refName, processor), state, lastParent, place)) {
        return false;
      }
    }
  }

  return true;
}
项目:tools-idea    文件:ConflictFilterProcessor.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (hintKey == NameHint.KEY) {
    //noinspection unchecked
    return myName != null ? (T)this : null;
  }
  return super.getHint(hintKey);
}
项目:tools-idea    文件:MethodResolveProcessor.java   
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (hintKey == ElementClassHint.KEY) {
    return (T)this;
  }
  if (hintKey == NameHint.KEY && myNameHint != null) {
    return (T)this;
  }
  return null;
}
项目:tools-idea    文件:PsiClassImplUtil.java   
public static boolean processDeclarationsInClass(@NotNull PsiClass aClass,
                                                 @NotNull final PsiScopeProcessor processor,
                                                 @NotNull ResolveState state,
                                                 @Nullable Set<PsiClass> visited,
                                                 PsiElement last,
                                                 @NotNull PsiElement place,
                                                 @NotNull LanguageLevel languageLevel,
                                                 boolean isRaw) {
  if (last instanceof PsiTypeParameterList || last instanceof PsiModifierList) {
    return true; //TypeParameterList and ModifierList do not see our declarations
  }
  if (visited != null && visited.contains(aClass)) return true;

  PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
  isRaw = isRaw || PsiUtil.isRawSubstitutor(aClass, substitutor);

  ParameterizedCachedValue<MembersMap, PsiClass> cache = getValues(aClass); //aClass.getUserData(MAP_IN_CLASS_KEY);
  boolean upToDate = cache.hasUpToDateValue();
  if (/*true || */upToDate) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    if (nameHint != null) {
      String name = nameHint.getName(state);
      return processCachedMembersByName(aClass, processor, state, visited, last, place, isRaw, substitutor, cache.getValue(aClass), name,languageLevel);
    }
  }
  return processDeclarationsInClassNotCached(aClass, processor, state, visited, last, place, isRaw, languageLevel);
}
项目:tools-idea    文件:StaticImportResolveProcessor.java   
@Override
public <T> T getHint(@NotNull final Key<T> hintKey) {
  if (hintKey == NameHint.KEY) {
    //noinspection unchecked
    return (T)this;
  }
  return super.getHint(hintKey);
}
项目:tools-idea    文件:PsiCodeBlockImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
  if (lastParent == null) {
    // Parent element should not see our vars
    return true;
  }
  Pair<Set<String>, Set<String>> pair = buildMaps();
  boolean conflict = pair == null;
  final Set<String> classesSet = conflict ? null : pair.getFirst();
  final Set<String> variablesSet = conflict ? null : pair.getSecond();
  final NameHint hint = processor.getHint(NameHint.KEY);
  if (hint != null && !conflict) {
    final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
    final String name = hint.getName(state);
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
  }
  else {
    return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
  }
  return true;
}
项目:tools-idea    文件:PsiClassImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  if (isEnum()) {
    String name = getName();
    if (name != null) {
      try {
        final NameHint nameHint = processor.getHint(NameHint.KEY);
        final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
        if (nameHint == null || VALUES_METHOD.equals(nameHint.getName(state))) {
          if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD)) {
            if (!processor.execute(getValuesMethod(), ResolveState.initial())) return false;
          }
        }
        if (nameHint == null || VALUE_OF_METHOD.equals(nameHint.getName(state))) {
          if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.METHOD)) {
            if (!processor.execute(getValueOfMethod(), ResolveState.initial())) return false;
          }
        }
      }
      catch (IncorrectOperationException e) {
        LOG.error(e);
      }
    }
  }

  return PsiClassImplUtil.processDeclarationsInClass(this, processor, state, null, lastParent, place, PsiUtil.getLanguageLevel(place), false);
}
项目:tools-idea    文件:ResolveUtil.java   
static PsiScopeProcessor substituteProcessor(PsiScopeProcessor processor, PsiElement scope) {
  //hack for walking up in java code
  //java's processDeclarations don't check names so we should do it manually
  if (scope.getLanguage() != GroovyFileType.GROOVY_LANGUAGE && processor.getHint(NameHint.KEY) != null) {
    return new JavaResolverProcessor(processor);
  }
  return processor;
}
项目:tools-idea    文件:ResolveUtil.java   
@Nullable
public static String getNameHint(PsiScopeProcessor processor) {
  NameHint nameHint = processor.getHint(NameHint.KEY);
  if (nameHint == null) {
    return null;
  }

  return nameHint.getName(ResolveState.initial());
}
项目:tools-idea    文件:ResolveUtil.java   
public static boolean processElement(@NotNull PsiScopeProcessor processor, @NotNull PsiNamedElement namedElement, @NotNull ResolveState state) {
  NameHint nameHint = processor.getHint(NameHint.KEY);
  String name = nameHint == null ? null : nameHint.getName(state);
  if (name == null || name.equals(namedElement.getName())) {
    return processor.execute(namedElement, state);
  }

  return true;
}
项目:tools-idea    文件:ResolverProcessor.java   
@SuppressWarnings({"unchecked"})
public <T> T getHint(@NotNull Key<T> hintKey) {
  if ((NameHint.KEY == hintKey && myName != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
    return (T)this;
  }

  return null;
}
项目:tools-idea    文件:GroovyConstructorNamedArgumentProvider.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey) {
  if ((NameHint.KEY == hintKey && myNameHint != null) || ClassHint.KEY == hintKey || ElementClassHint.KEY == hintKey) {
    //noinspection unchecked
    return (T) this;
  }

  return null;
}
项目:consulo-javaee    文件:JspCodeBlockImpl.java   
private boolean processImpl(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place)
{
    processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
    if(lastParent == null)
    {
        // Parent element should not see our vars
        return true;
    }
    Pair<Set<String>, Set<String>> pair = buildMaps();
    boolean conflict = pair == null;
    final Set<String> classesSet = conflict ? null : pair.getFirst();
    final Set<String> variablesSet = conflict ? null : pair.getSecond();
    final NameHint hint = processor.getHint(NameHint.KEY);
    if(hint != null && !conflict)
    {
        final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
        final String name = hint.getName(state);
        if((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name))
        {
            return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
        }
        if((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name))
        {
            return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
        }
    }
    else
    {
        return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
    return true;
}
项目:DeftIDEA    文件:ResolveUtil.java   
public static boolean processElement(PsiScopeProcessor processor, PsiNamedElement namedElement) {
  if (namedElement == null) return true;
  NameHint nameHint = processor.getHint(NameHint.KEY);
  String name = nameHint == null ? null : nameHint.getName(ResolveState.initial());
  if (name == null || name.equals(namedElement.getName())) {
    return processor.execute(namedElement, ResolveState.initial());
  }
  return true;
}
项目:consulo-java    文件:ConflictFilterProcessor.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey)
{
    if(hintKey == NameHint.KEY)
    {
        //noinspection unchecked
        return myName != null ? (T) this : null;
    }
    return super.getHint(hintKey);
}
项目:consulo-java    文件:MethodResolveProcessor.java   
public <T> T getHint(@NotNull Key<T> hintKey) {
  if (hintKey == ElementClassHint.KEY) {
    return (T)this;
  }
  if (hintKey == NameHint.KEY && myNameHint != null) {
    return (T)this;
  }
  return null;
}
项目:consulo-java    文件:PsiClassImplUtil.java   
private static boolean processDeclarationsInClass(@NotNull PsiClass aClass,
        @NotNull final PsiScopeProcessor processor,
        @NotNull ResolveState state,
        @Nullable Set<PsiClass> visited,
        PsiElement last,
        @NotNull PsiElement place,
        @NotNull LanguageLevel languageLevel,
        boolean isRaw,
        @NotNull GlobalSearchScope resolveScope)
{
    if(last instanceof PsiTypeParameterList || last instanceof PsiModifierList && aClass.getModifierList() == last)
    {
        return true;
    }
    if(visited != null && visited.contains(aClass))
    {
        return true;
    }

    PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY);
    isRaw = isRaw || PsiUtil.isRawSubstitutor(aClass, substitutor);

    final NameHint nameHint = processor.getHint(NameHint.KEY);
    if(nameHint != null)
    {
        String name = nameHint.getName(state);
        return processCachedMembersByName(aClass, processor, state, visited, last, place, isRaw, substitutor, getValues(aClass).getValue(aClass).get(resolveScope), name, languageLevel);
    }
    return processDeclarationsInClassNotCached(aClass, processor, state, visited, last, place, isRaw, languageLevel, resolveScope);
}
项目:consulo-java    文件:ClassResolverProcessor.java   
@Override
public <T> T getHint(@NotNull Key<T> hintKey)
{
    if(hintKey == ElementClassHint.KEY || hintKey == NameHint.KEY)
    {
        @SuppressWarnings("unchecked") T t = (T) this;
        return t;
    }
    return super.getHint(hintKey);
}
项目:consulo-java    文件:StaticImportResolveProcessor.java   
@Override
public <T> T getHint(@NotNull final Key<T> hintKey) {
  if (hintKey == NameHint.KEY) {
    //noinspection unchecked
    return (T)this;
  }
  return super.getHint(hintKey);
}
项目:consulo-java    文件:PsiCodeBlockImpl.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
  if (lastParent == null) {
    // Parent element should not see our vars
    return true;
  }
  Pair<Set<String>, Set<String>> pair = buildMaps();
  boolean conflict = pair == null;
  final Set<String> classesSet = conflict ? null : pair.getFirst();
  final Set<String> variablesSet = conflict ? null : pair.getSecond();
  final NameHint hint = processor.getHint(NameHint.KEY);
  if (hint != null && !conflict) {
    final ElementClassHint elementClassHint = processor.getHint(ElementClassHint.KEY);
    final String name = hint.getName(state);
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) && classesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
    if ((elementClassHint == null || elementClassHint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) && variablesSet.contains(name)) {
      return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
    }
  }
  else {
    return PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place);
  }
  return true;
}
项目:IntelliFrog    文件:ResolveUtil.java   
public static boolean processElement(PsiScopeProcessor processor, PsiNamedElement namedElement) {
    if (namedElement == null) return true;
    NameHint nameHint = processor.getHint(NameHint.KEY);
    String name = nameHint == null ? null : nameHint.getName(ResolveState.initial());
    if (name == null || name.equals(namedElement.getName())) {
        return processor.execute(namedElement, ResolveState.initial());
    }
    return true;
}
项目:intellij-ce-playground    文件:DataBindingUtil.java   
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {
  boolean continueProcessing = super.processDeclarations(processor, state, lastParent, place);
  if (!continueProcessing) {
    return false;
  }
  List<PsiDataBindingResourceItem> imports = myInfo.getItems(DataBindingResourceType.IMPORT);
  if (imports == null || imports.isEmpty()) {
    return true;
  }
  final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
  if (classHint != null && classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
    final NameHint nameHint = processor.getHint(NameHint.KEY);
    final String name = nameHint != null ? nameHint.getName(state) : null;
    for (PsiDataBindingResourceItem imp : imports) {
      String alias = imp.getExtra(SdkConstants.ATTR_ALIAS);
      if (alias != null) {
        continue; // aliases are pre-resolved in {@linkplain #replaceImportAliases}
      }
      String qName = imp.getExtra(SdkConstants.ATTR_TYPE);
      if (qName == null) {
        continue;
      }

      if (name != null && !qName.endsWith("." + name)) {
        continue;
      }

      Module module = myInfo.getModule();
      if (module == null) {
        return true; // this should not really happen but just to be safe
      }
      PsiClass aClass = JavaPsiFacade.getInstance(myManager.getProject()).findClass(qName, module
        .getModuleWithDependenciesAndLibrariesScope(true));
      if (aClass != null) {
        if (!processor.execute(aClass, state)) {
          // found it!
          return false;
        }
      }
    }
  }
  return true;
}