PsiPackage () { if (myTree == null) return null; TreePath path = myTree.getSelectionPath(); if (path == null) return null; DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent(); return (PsiPackage)node.getUserObject(); }