PsiExpression (PsiElement element) { if (!(element instanceof PsiIdentifier)) return null; if (!element.getText().equals(myMethodName)) return null; PsiReferenceExpression ref = ObjectUtils.tryCast(element.getParent(), PsiReferenceExpression.class); if (ref == null) return null; PsiMethodCallExpression call = ObjectUtils.tryCast(ref.getParent(), PsiMethodCallExpression.class); if (call == null) return null; PsiExpressionList argumentList = call.getArgumentList(); PsiMethod method = call.resolveMethod(); if (method == null) return null; PsiClass psiClass = method.getContainingClass(); if (psiClass == null) return null; if (!myClassName.equals(psiClass.getName())) { PsiClass aClass = ClassUtil.findPsiClass(method.getManager(), myFullClassName.replace('/', '.'), null, true); if (aClass == null || !aClass.isInheritor(psiClass, true)) return null; PsiMethod subClassMethod = aClass.findMethodBySignature(method, false); if (subClassMethod == null) return null; method = subClassMethod; } PsiParameter[] parameters = method.getParameterList().getParameters(); for (int i = 0; i < parameters.length; i++) { if (parameters[i].getName().equals(myParameterName)) { PsiExpression[] expressions = argumentList.getExpressions(); if (expressions.length > i) { return expressions[i]; } return null; } } return null; }