private static ThreeStateCheckBox.State getStateFromChildren(DefaultMutableTreeNode node) {
    boolean allEnabled = true;
    boolean anyEnabled = false;
    Enumeration<?> children = node.children();
    while (children.hasMoreElements()) {
      if (anyEnabled && !allEnabled) return ThreeStateCheckBox.State.DONT_CARE;
      DefaultMutableTreeNode child = (DefaultMutableTreeNode)children.nextElement();
      ConfigurationDescriptor descriptor = (ConfigurationDescriptor)child.getUserObject();

      allEnabled = allEnabled && descriptor.isChecked();
      anyEnabled = anyEnabled || descriptor.isChecked();
    }
    if (allEnabled) return ThreeStateCheckBox.State.SELECTED;
    if (anyEnabled) return ThreeStateCheckBox.State.DONT_CARE;
    return ThreeStateCheckBox.State.NOT_SELECTED;
  }
private static ThreeStateCheckBox.State getStateFromChildren(DefaultMutableTreeNode node)