boolean (PsiElement element, PsiCallExpression parent, int parameterIndex) { PsiExpression qualifier = null; if (parent instanceof PsiMethodCallExpression) { qualifier = ((PsiMethodCallExpression)parent).getMethodExpression(); } else if (parent instanceof PsiNewExpression) { qualifier = ((PsiNewExpression)parent).getQualifier(); } if (PsiTreeUtil.isAncestor(qualifier, element, true)) { return true; } final PsiExpressionList list = parent.getArgumentList(); return list != null && !PsiTreeUtil.isAncestor(list.getExpressions()[parameterIndex], element, false); }