PsiClass (@NotNull PsiElement place, @NotNull PsiClass aClass) { if (!aClass.hasModifierProperty(PsiModifier.STATIC)) { PsiClass containingClass = aClass.getContainingClass(); if (containingClass != null) { if (PsiUtil.hasEnclosingInstanceInScope(containingClass, place, true)) { return containingClass; } } } return null; }