PsiClass (final PsiReferenceExpression place) { final JavaResolveResult resolveResult = place.advancedResolve(false); final PsiElement scope = resolveResult.getCurrentFileResolveScope(); if (scope instanceof PsiClass) { return (PsiClass)scope; } return null; }