/** * Adds dataType's data type information, including enumerated type values * to string buffer, sb * */ protected void printDataTypeInfo(StringBuffer sb, CMDataType dataType) { String dataTypeName = dataType.getNodeName(); if ((dataTypeName != null) && (dataTypeName.length() > 0)) { sb.append(PARAGRAPH_START + BOLD_START + XMLUIMessages.Data_Type____4 + SPACE + BOLD_END); sb.append(dataTypeName); sb.append(PARAGRAPH_END); } String[] enumeratedValue = dataType.getEnumeratedValues(); if ((enumeratedValue != null) && (enumeratedValue.length > 0)) { sb.append(PARAGRAPH_START + BOLD_START + XMLUIMessages.Enumerated_Values____5 + SPACE + BOLD_END); sb.append(LIST_BEGIN); for (int i = 0; i < enumeratedValue.length; i++) { sb.append(LIST_ELEMENT + enumeratedValue[i]); } sb.append(PARAGRAPH_END); } }
public void generateRequiredAttribute(Node ownerNode, CMAttributeDeclaration attrDecl, StringBuffer buffer) { if ((attrDecl == null) || (buffer == null)) { return; } // attribute name String attributeName = getRequiredName(ownerNode, attrDecl); CMDataType attrType = attrDecl.getAttrType(); // = sign buffer.append(attributeName + "=\""); //$NON-NLS-1$ // attribute value if (attrType != null) { // insert any value that is implied if ((attrType.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_NONE) && (attrType.getImpliedValue() != null)) { buffer.append(attrType.getImpliedValue()); } // otherwise, if an enumerated list of values exists, use the // first value else if ((attrType.getEnumeratedValues() != null) && (attrType.getEnumeratedValues().length > 0)) { buffer.append(attrType.getEnumeratedValues()[0]); } } buffer.append("\""); //$NON-NLS-1$ return; }
/** */ 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())); } }
String[] values = dataType.getEnumeratedValues(); if (values != null && values.length > 0)
/** * This method returns true if all of the following conditions are met: * (1) value type is ENUM, * (2) only one value is defined in the enumeration, * (3) the value has same name to the attribute name. */ public static boolean isBooleanAttr(CMAttributeDeclaration adec) { CMDataType attrtype = adec.getAttrType(); if (attrtype == null) return false; if (attrtype.getDataTypeName() != CMDataType.ENUM) return false; String[] values = attrtype.getEnumeratedValues(); if (values.length != 1) return false; return values[0].equals(adec.getAttrName()); }
dataTypeValues = ad.getAttrType().getEnumeratedValues();
valueStrings = attrDecl.getAttrType().getEnumeratedValues();
String[] enumeratedValues = dataType != null ? dataType.getEnumeratedValues() : null; if (enumeratedValues != null)
protected IPropertyDescriptor createPropertyDescriptor(CMAttributeDeclaration attrDecl) { IPropertyDescriptor descriptor = null; CMDataType attrType = attrDecl.getAttrType(); if (attrType != null) { // handle declarations that provide FIXED/ENUMERATED values if ((attrType.getEnumeratedValues() != null) && (attrType.getEnumeratedValues().length > 0)) { descriptor = createEnumeratedPropertyDescriptor(attrDecl, attrType); } else if (((attrDecl.getUsage() == CMAttributeDeclaration.FIXED) || (attrType.getImpliedValueKind() == CMDataType.IMPLIED_VALUE_FIXED)) && (attrType.getImpliedValue() != null)) { descriptor = createFixedPropertyDescriptor(attrDecl, attrType); } else { // plain text descriptor = createTextPropertyDescriptor(attrDecl); } } else { // no extra information given descriptor = createTextPropertyDescriptor(attrDecl); } return descriptor; }
String[] candidates = attrType.getEnumeratedValues(); if (candidates != null && candidates.length > 0) {
String[] childStrings = childType.getEnumeratedValues(); if (childStrings != null) {