PatternDescriptor getSelectedDescriptor() {
    DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode != null) {
      Object object = selectedNode.getUserObject();
      if (object instanceof PatternDescriptor) {
        return (PatternDescriptor)object;
      }
    }
    return null;
  }
PatternDescriptor getSelectedDescriptor()