PsiManagerEx () { CompositeElement treeParent = getTreeParent(); if (treeParent != null) return treeParent.getManager(); PsiElement psi = getPsi(); if (psi == null) throw PsiInvalidElementAccessException.createByNode(this, null); return (PsiManagerEx)psi.getManager(); }