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


Java PsiScopeProcessor.execute方法代码示例

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


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

示例1: process

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public static boolean process(PsiScopeProcessor processor, boolean isInStaticContext, PsiElement place, String classSource) {
  ClassHint classHint = processor.getHint(ClassHint.KEY);
  String name = ResolveUtil.getNameHint(processor);

  ClassMemberHolder memberHolder = getMembers(place.getProject(), classSource);

  if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.METHOD)) {
    PsiMethod[] methods = isInStaticContext ? memberHolder.getStaticMethods(name) : memberHolder.getMethods(name);
    for (PsiMethod method : methods) {
      if (!processor.execute(method, ResolveState.initial())) return false;
    }
  }

  if (classHint == null || classHint.shouldProcess(ClassHint.ResolveKind.PROPERTY)) {
    PsiField[] fields = isInStaticContext ? memberHolder.getStaticFields(name) : memberHolder.getFields(name);
    for (PsiField field : fields) {
      if (!processor.execute(field, ResolveState.initial())) return false;
    }
  }

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

示例2: processMethod

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
private static boolean processMethod(@NotNull GrTypeDefinition grType,
                                     @NotNull PsiScopeProcessor processor,
                                     @NotNull ResolveState state,
                                     @NotNull PsiElement place,
                                     boolean processInstanceMethods,
                                     @NotNull PsiSubstitutor substitutor,
                                     @NotNull PsiElementFactory factory,
                                     @NotNull LanguageLevel level,
                                     boolean placeGroovy,
                                     @NotNull CandidateInfo info) {
  PsiMethod method = (PsiMethod)info.getElement();
  if (!processInstanceMember(processInstanceMethods, method) || isSameDeclaration(place, method) || !isMethodVisible(placeGroovy, method)) {
    return true;
  }
  LOG.assertTrue(method.getContainingClass() != null);
  final PsiSubstitutor finalSubstitutor = PsiClassImplUtil.obtainFinalSubstitutor(method.getContainingClass(), info.getSubstitutor(), grType, substitutor, factory, level);

  return processor.execute(method, state.put(PsiSubstitutor.KEY, finalSubstitutor));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GrClassImplUtil.java

示例3: 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

示例4: processPageFields

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public static boolean processPageFields(PsiScopeProcessor processor,
                                        @NotNull PsiClass pageClass,
                                        ResolveState state) {
  Map<String, PsiClass> supers = ClassUtil.getSuperClassesWithCache(pageClass);
  String nameHint = ResolveUtil.getNameHint(processor);

  for (PsiClass psiClass : supers.values()) {
    Map<String, PsiField> contentFields = GebUtil.getContentElements(psiClass);

    if (nameHint == null) {
      for (Map.Entry<String, PsiField> entry : contentFields.entrySet()) {
        if (!processor.execute(entry.getValue(), state)) return false;
      }
    }
    else {
      PsiField field = contentFields.get(nameHint);
      if (field != null) {
        return processor.execute(field, state);
      }
    }
  }

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

示例5: 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) return true;

  if (!PsiScopesUtil.walkChildrenScopes(this, processor, state, lastParent, place)) return false;

  final PsiParameter[] parameters = getParameterList().getParameters();
  for (PsiParameter parameter : parameters) {
    if (!processor.execute(parameter, state)) return false;
  }

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

示例6: processInstanceLevelDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processInstanceLevelDeclarations(@NotNull PsiScopeProcessor processor, @Nullable PsiElement location) {
  Map<String, PyTargetExpression> declarationsInMethod = new HashMap<String, PyTargetExpression>();
  PyFunction instanceMethod = PsiTreeUtil.getParentOfType(location, PyFunction.class);
  final PyClass containingClass = instanceMethod != null ? instanceMethod.getContainingClass() : null;
  if (instanceMethod != null && containingClass != null && CompletionUtil.getOriginalElement(containingClass) == this) {
    collectInstanceAttributes(instanceMethod, declarationsInMethod);
    for (PyTargetExpression targetExpression : declarationsInMethod.values()) {
      if (!processor.execute(targetExpression, ResolveState.initial())) {
        return false;
      }
    }
  }
  for (PyTargetExpression expr : getInstanceAttributes()) {
    if (declarationsInMethod.containsKey(expr.getName())) {
      continue;
    }
    if (!processor.execute(expr, ResolveState.initial())) return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:PyClassImpl.java

示例7: processDeclarations

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

示例8: 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

示例9: processNestedElements

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public boolean processNestedElements(PsiScopeProcessor processor) {
  final AntIntrospector introspector = AntDomExtender.getIntrospector(myAntClass);
  if (introspector != null) {
    String expectedName = ResolveUtil.getNameHint(processor);
    final PsiType stringType = getParameterList().getParameters()[1].getType();
    final PsiType closureType = getParameterList().getParameters()[2].getType();

    for (String name : Collections.list(introspector.getNestedElements())) {
      if (expectedName == null || expectedName.equals(name)) {
        final AntBuilderMethod method = new AntBuilderMethod(myPlace, name, closureType, introspector.getElementType(name),
                                                             stringType);
        if (!processor.execute(method, ResolveState.initial())) return false;
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AntBuilderMethod.java

示例10: processTaskAddition

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
private static void processTaskAddition(@NotNull String name,
                                        @NotNull String handlerClass,
                                        @NotNull PsiScopeProcessor processor,
                                        @NotNull ResolveState state,
                                        @NotNull PsiElement place) {
  GroovyPsiManager psiManager = GroovyPsiManager.getInstance(place.getProject());
  PsiClass psiClass = psiManager.findClassWithCache(handlerClass, place.getResolveScope());
  if (psiClass == null) {
    return;
  }

  GrLightMethodBuilder builder = new GrLightMethodBuilder(place.getManager(), name);
  PsiElementFactory factory = JavaPsiFacade.getElementFactory(place.getManager().getProject());
  PsiType type = new PsiArrayType(factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_OBJECT, place.getResolveScope()));
  builder.addParameter(new GrLightParameter("taskInfo", type, builder));
  PsiClassType retType = factory.createTypeByFQClassName(CommonClassNames.JAVA_LANG_STRING, place.getResolveScope());
  builder.setReturnType(retType);
  processor.execute(builder, state);

  GrMethodCall call = PsiTreeUtil.getParentOfType(place, GrMethodCall.class);
  if (call == null) {
    return;
  }
  GrArgumentList args = call.getArgumentList();
  if (args == null) {
    return;
  }

  int argsCount = GradleResolverUtil.getGrMethodArumentsCount(args);
  argsCount++; // Configuration name is delivered as an argument.

  for (PsiMethod method : psiClass.findMethodsByName("create", false)) {
    if (method.getParameterList().getParametersCount() == argsCount) {
      builder.setNavigationElement(method);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:GradleTaskContributor.java

示例11: processMembers

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processMembers(GroovyClassDescriptor descriptor, PsiScopeProcessor processor, ResolveState state) {
  for (PsiElement method : myDeclarations) {
    if (!processor.execute(method, state)) {
      return false;
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:NonCodeMembersHolder.java

示例12: 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

示例13: addImplicitVariable

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
public static void addImplicitVariable(@NotNull PsiScopeProcessor processor,
                                       @NotNull ResolveState state,
                                       @NotNull PsiElement element,
                                       @NotNull String type) {
  PsiVariable myPsi = new GrImplicitVariableImpl(element.getManager(), element.getText(), type, element);
  processor.execute(myPsi, state);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GradleResolverUtil.java

示例14: processDeclarations

import com.intellij.psi.scope.PsiScopeProcessor; //导入方法依赖的package包/类
@Override
public boolean processDeclarations(@NotNull final PsiScopeProcessor processor,
                                   @NotNull final ResolveState state, final PsiElement lastParent, @NotNull final PsiElement place) {
  for (final PsiElement declaration : myDeclarations) {
    if (!processor.execute(declaration, state)) return false;
  }

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

示例15: 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


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