本文整理汇总了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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}
}