PsiClass (Object value) { if (!(value instanceof TreeNode)) return null; for (TreeNode treeNode = ((TreeNode) value).getParent(); treeNode != null; treeNode = treeNode.getParent()) { Object element = getElement(treeNode); if (element instanceof PsiClass) return (PsiClass) element; } return null; }