FeatureInfo feature = (FeatureInfo) nodeInfo;
            public void valueChanged(TreeSelectionEvent e) {                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();                if (node == null)                    return;                Object nodeInfo = node.getUserObject();                if (node.isLeaf() && nodeInfo instanceof FeatureInfo) {                    FeatureInfo feature = (FeatureInfo) nodeInfo;                    currentFeature = node;                    // enable addToLayer button here.                    addFeatureButton.setEnabled(true);                } else {                    // disable addToLayer button here.                    addFeatureButton.setEnabled(false);                }            }