PsiExpression (PsiElement element) { if (element instanceof PsiNewExpression) { PsiJavaCodeReferenceElement ref = ((PsiNewExpression) element).getClassReference(); if (ref instanceof PsiReferenceExpression) { return ((PsiReferenceExpression) ref).getQualifierExpression(); } } else if (element instanceof PsiReferenceExpression) { return ((PsiReferenceExpression) element).getQualifierExpression(); } else if (element instanceof PsiMethodCallExpression) { return ((PsiMethodCallExpression) element).getMethodExpression().getQualifierExpression(); } return null; }