当前位置: 首页>>代码示例>>Java>>正文


Java PsiScopeProcessor.getHint方法代码示例

本文整理汇总了Java中com.intellij.psi.scope.PsiScopeProcessor.getHint方法的典型用法代码示例。如果您正苦于以下问题:Java PsiScopeProcessor.getHint方法的具体用法?Java PsiScopeProcessor.getHint怎么用?Java PsiScopeProcessor.getHint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.scope.PsiScopeProcessor的用法示例。


在下文中一共展示了PsiScopeProcessor.getHint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processDeclarationsInClass

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PsiClassImplUtil.java

示例2: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement place) {
  processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
  PsiElement[] decls = getDeclaredElements();
  for (PsiElement decl : decls) {
    if (decl != lastParent) {
      if (!processor.execute(decl, state)) return false;
    }
    else {
      final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
      if (lastParent instanceof PsiClass) {
        if (hint == null || hint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
          if (!processor.execute(lastParent, state)) return false;
        }
      }
    }
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PsiDeclarationStatementImpl.java

示例3: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaDummyHolder.java

示例4: processDeclarationsForSingleElement

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GrImportStatementImpl.java

示例5: processDynamicElements

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
                                   PsiClass aClass,
                                   @NotNull PsiScopeProcessor processor,
                                   @NotNull PsiElement place,
                                   @NotNull ResolveState state) {
  ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;

  MultiMap<String, PsiMethod> methodMap = aClass.getUserData(KEY);
  if (methodMap == null) {
    MyBuilder builder = new MyBuilder(aClass);
    builder.generateMethods();
    methodMap = ((UserDataHolderEx)aClass).putUserDataIfAbsent(KEY, builder.myResult);
  }

  String nameHint = ResolveUtil.getNameHint(processor);

  Collection<? extends PsiMethod> methods = nameHint == null ? methodMap.values() : methodMap.get(nameHint);

  for (PsiMethod method : methods) {
    if (!processor.execute(method, state)) return;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SwingBuilderNonCodeMemberContributor.java

示例6: processDynamicElements

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public void processDynamicElements(@NotNull PsiType qualifierType,
                                   PsiClass aClass,
                                   @NotNull PsiScopeProcessor processor,
                                   @NotNull PsiElement place,
                                   @NotNull ResolveState state) {
  String nameHint = ResolveUtil.getNameHint(processor);

  if (nameHint == null) return;

  ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return;

  GrLightMethodBuilder res = new GrLightMethodBuilder(aClass.getManager(), nameHint);
  res.addParameter("attrs", CommonClassNames.JAVA_UTIL_MAP, false);
  res.addParameter("content", CommonClassNames.JAVA_LANG_OBJECT, false);
  res.setOriginInfo("XML tag");

  if (!processor.execute(res, state)) return;

  res = new GrLightMethodBuilder(aClass.getManager(), nameHint);
  res.addParameter("contentOrAttrs", CommonClassNames.JAVA_LANG_OBJECT, true);
  res.setOriginInfo("XML tag");

  processor.execute(res, state);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:XmlMarkupBuilderNonCodeMemberContributor.java

示例7: processMethods

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GdkMethodHolder.java

示例8: treeWalkUp

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
/**
 *
 * @param place - place to start tree walk up
 * @param processor
 * @param processNonCodeMethods - this parameter tells us if we need non code members
 * @param state
 * @return
 */
public static boolean treeWalkUp(@NotNull final PsiElement place,
                                 @NotNull final PsiElement originalPlace,
                                 @NotNull final PsiScopeProcessor processor,
                                 boolean processNonCodeMethods,
                                 @NotNull final ResolveState state) {
  try {
  ClassHint hint = processor.getHint(ClassHint.KEY);
  if (hint != null) {
    return new DeclarationCacheKey(getNameHint(processor), hint, processNonCodeMethods, originalPlace).processCachedDeclarations(place, processor);
  }

  final PsiScopeProcessor nonCodeProcessor = processNonCodeMethods ? processor : null;
    return doTreeWalkUp(place, originalPlace, processor, nonCodeProcessor, state);
  }
  catch (StackOverflowError e) {
    LOG.error("StackOverflow", e, place.getContainingFile().getText());
    throw e;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ResolveUtil.java

示例9: categoryIteration

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public static boolean categoryIteration(GrClosableBlock place, final PsiScopeProcessor processor, ResolveState state) {
  final ClassHint classHint = processor.getHint(ClassHint.KEY);
  if (classHint != null && !classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) return true;
  
  final GrMethodCall call = checkMethodCall(place, USE);
  if (call == null) return true;

  final GrClosableBlock[] closures = call.getClosureArguments();
  GrExpression[] args = call.getExpressionArguments();
  if (!(placeEqualsSingleClosureArg(place, closures) || placeEqualsLastArg(place, args))) return true;

  if (!(call.resolveMethod() instanceof GrGdkMethod)) return true;

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

  if ((args.length == 1 || args.length == 2 && placeEqualsLastArg(place, args))) {
    PsiType type = args[0].getType();
    if (type instanceof GrTupleType) {
      return processTypesFromTuple((GrTupleType)type, processor, state, place);
    }
  }
  return processTypesFomArgs(args, processor, state, place);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GdkMethodUtil.java

示例10: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor,
                                   @NotNull ResolveState state,
                                   PsiElement lastParent,
                                   @NotNull PsiElement place) {
  processor.handleEvent(PsiScopeProcessor.Event.SET_DECLARATION_HOLDER, this);
  final ElementClassHint classHint = processor.getHint(ElementClassHint.KEY);
  if (classHint == null || classHint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
    final PsiClass[] classes = getClasses();
    for (PsiClass aClass : classes) {
      if (!processor.execute(aClass, state)) return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ClsFileImpl.java

示例11: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:PsiCodeBlockImpl.java

示例12: processDeclarationsInResourceList

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public static boolean processDeclarationsInResourceList(@NotNull final PsiResourceList resourceList,
                                                        @NotNull final PsiScopeProcessor processor,
                                                        @NotNull final ResolveState state,
                                                        final PsiElement lastParent) {
  final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
  if (hint != null && !hint.shouldProcess(ElementClassHint.DeclarationKind.VARIABLE)) return true;

  for (PsiResourceListElement resource : resourceList) {
    if (resource == lastParent) break;
    if (resource instanceof PsiResourceVariable && !processor.execute(resource, state)) return false;
  }

  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:PsiImplUtil.java

示例13: handleEmptyContext

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public void handleEmptyContext(PsiScopeProcessor processor, PsiElement position) {
  final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
  if (position == null) return;
  if (hint == null || hint.shouldProcess(ElementClassHint.DeclarationKind.PACKAGE) || hint.shouldProcess(ElementClassHint.DeclarationKind.CLASS)) {
    final List<PsiElement> cachedPackages = getDefaultPackages(position.getProject());
    for (final PsiElement psiPackage : cachedPackages) {
      if (!processor.execute(psiPackage, ResolveState.initial())) return;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaClassReferenceProvider.java

示例14: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState substitutor, PsiElement lastParent, @NotNull PsiElement place) {
  final FollowFileHint hint = processor.getHint(FollowFileHint.KEY);
  final RncFile file = getReferencedFile();
  if (file != null && hint != null && hint.doFollow(file)) {
    file.processDeclarations(processor, substitutor, lastParent, place);
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RncFileReferenceImpl.java

示例15: substituteProcessor

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ResolveUtil.java


注:本文中的com.intellij.psi.scope.PsiScopeProcessor.getHint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。