private boolean isBooleanAttr(Attr attr) { if (attr == null) return false; CMAttributeDeclaration decl = CMNodeUtil.getAttributeDeclaration(attr); if (decl == null) return false; CMDataType type = decl.getAttrType(); if (type == null) return false; String values[] = type.getEnumeratedValues(); if (values == null) return false; return (values.length == 1 && values[0].equals(decl.getAttrName())); }
public Command getUpdateValueCommand(String newValue) { switch (kind) { case KIND_ATTR_TEXT: case KIND_ELEMENT_ATTR: { // note intentional fall-thru!! return new UpdateAttributeValueCommand(parent, attribute.getNodeName(), newValue, true); } case KIND_ELEMENT_CMATTRIBUTE: { final CMAttributeDeclaration ad = (CMAttributeDeclaration) cmNode; return new UpdateAttributeValueCommand(parent, ad.getAttrName(), newValue, true); } case KIND_ELEMENT_TEXT: { return new UpdateTextValueCommand(parent, newValue); } } return null; }