PsiClassInitializer (@NotNull PsiElement root) { PsiElement element = root; while (element != null) { if (element instanceof PsiClassInitializer) return (PsiClassInitializer)element; if (element instanceof PsiClass || element instanceof PsiMethod) return null; element = element.getParent(); } return null; }