PsiClass (GrReferenceExpression refExpr) { if (refExpr.getQualifier() == null) { return PsiUtil.getContextClass(refExpr); } PsiType type = PsiImplUtil.getQualifierType(refExpr); if (ResolveUtil.resolvesToClass(refExpr.getQualifierExpression())) { PsiType classType = ResolveUtil.unwrapClassType(type); if (classType != null) { type = classType; } } if (!(type instanceof PsiClassType)) return null; return ((PsiClassType)type).resolve(); }