PsiClass (PsiThisExpression thisExpression, PsiElement context) { final PsiJavaCodeReferenceElement qualifier = thisExpression.getQualifier(); if (qualifier == null) { return PsiTreeUtil.getParentOfType(context, PsiClass.class); } else { final PsiElement target = qualifier.resolve(); return target instanceof PsiClass ? (PsiClass)target : null; } }