PsiManagerEx () { Project project = ProjectCoreUtil.theOnlyOpenProject(); if (project != null) { return PsiManagerEx.getInstanceEx(project); } TreeElement element; CompositeElement parent; for (element = this; (parent = element.getTreeParent()) != null; element = parent) { } if (element instanceof FileElement) { //TODO!! return element.getManager(); } parent = getTreeParent(); if (parent != null) { return parent.getManager(); } return null; }