@Override public boolean execute(PsiElement element, ResolveState state) { if (element instanceof PsiMethod || element instanceof PsiField) { String propertyName; PsiType type; if (element instanceof PsiMethod) { PsiMethod method = (PsiMethod) element; if (!GroovyPropertyUtils.isSimplePropertySetter(method)) return true; propertyName = GroovyPropertyUtils.getPropertyNameBySetter(method); if (propertyName == null) return true; type = method.getParameterList().getParameters()[0].getType(); } else { type = ((PsiField) element).getType(); propertyName = ((PsiField) element).getName(); } if (((PsiModifierListOwner) element).hasModifierProperty(PsiModifier.STATIC)) return true; if (myResult.containsKey(propertyName) || propertyName.equals(METACLASS)) return true; PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY); if (substitutor != null) { type = substitutor.substitute(type); } myResult.put(propertyName, new TypeCondition(type, element)); } return true; }
public static void processClass( @NotNull GrCall call, PsiClassType type, @Nullable String argumentName, Map<String, ArgumentDescriptor> result) { if (argumentName == null) { ResolveUtil.processAllDeclarations( type, new MyPsiScopeProcessor(result, call), ResolveState.initial(), call); } else { ResolveUtil.processAllDeclarations( type, new MyPsiScopeProcessor(argumentName, true, result, call), ResolveState.initial(), call); ResolveUtil.processAllDeclarations( type, new MyPsiScopeProcessor(argumentName, false, result, call), ResolveState.initial(), call); } }