boolean (PsiClass otherClass) { if (otherClass.hasModifierProperty(PsiModifier.PRIVATE)) { final PsiClass containingClass = otherClass.getContainingClass(); PsiClass containingPlaceClass = PsiTreeUtil.getContextOfType(myPlace, PsiClass.class, false); while (containingPlaceClass != null) { if (containingClass == containingPlaceClass) { return true; } containingPlaceClass = PsiTreeUtil.getContextOfType(containingPlaceClass, PsiClass.class); } return false; } return true; }