PsiClass (@NotNull PsiElement place) { PsiElement parent = place.getContext(); if (parent == null) return null; PsiElement prev = null; while (true) { if (parent instanceof PsiClass) { if (!(parent instanceof PsiAnonymousClass && ((PsiAnonymousClass)parent).getArgumentList() == prev)) { return (PsiClass)parent; } } prev = parent; parent = parent.getContext(); if (parent == null) return null; } }