public void visitCMAttributeDeclaration(CMAttributeDeclaration ad) { if (alwaysVisit || buildPolicy == BUILD_ALL_CONTENT || ad.getUsage() == CMAttributeDeclaration.REQUIRED) { createAttributeNode(ad); } }
public void generateAttribute(CMAttributeDeclaration attrDecl, StringBuffer buffer) { if ((attrDecl == null) || (buffer == null)) { return; } int usage = attrDecl.getUsage(); if (usage == CMAttributeDeclaration.REQUIRED) { buffer.append(" "); //$NON-NLS-1$ generateRequiredAttribute(null, attrDecl, buffer); // todo pass // ownerNode as // 1st param } return; }
public int getUsage() { return getSelf().getUsage(); }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
private List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; } }
protected List getRequiredAttrs(Node node) { List result = new ArrayList(); ModelQuery modelQuery = getModelQuery(node); if (modelQuery != null) { CMElementDeclaration elementDecl = modelQuery.getCMElementDeclaration((Element) node); if (elementDecl != null) { CMNamedNodeMap attrMap = elementDecl.getAttributes(); Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { result.add(attr); } } } } return result; }
public void visitCMAttributeDeclaration(CMAttributeDeclaration ad) { if (alwaysVisit || buildOptionalAttributes(buildPolicy) || ad.getUsage() == CMAttributeDeclaration.REQUIRED) { alwaysVisit = false; String name = computeName(ad, currentParent); String value = valueHelper.getValue(ad, namespaceTable); Attr attr = createAttribute(ad, name, currentParent); attr.setValue(value != null ? value : ""); //$NON-NLS-1$ linkNode(attr); } }
protected boolean requiresAttributes(CMElementDeclaration ed) { CMNamedNodeMap attributes = ed.getAttributes(); if (attributes == null) { return false; } for (int i = 0; i < attributes.getLength(); i++) { if (((CMAttributeDeclaration) attributes.item(i)).getUsage() == CMAttributeDeclaration.REQUIRED) { return true; } } return false; } }
if (sortedAttrs[i].getUsage() == CMAttributeDeclaration.REQUIRED) { attrInfo.append("*"); //$NON-NLS-1$ length++;
if (ad.getUsage() == CMAttributeDeclaration.REQUIRED)
idTypedAttribute = attr; else if ((attrDecl.getUsage() == CMAttributeDeclaration.REQUIRED) && (requiredAttribute == null)) {
result = CMImageUtil.getImageDescriptor(cmnode); if (result == null) { if (((CMAttributeDeclaration) cmnode).getUsage() == CMAttributeDeclaration.REQUIRED) { result = attributeReqImage;
if (ad != null) result = (ad.getUsage() == CMAttributeDeclaration.OPTIONAL);
/** * Add required attributes and default values, if set, to the created tag element * * To customize the attributes that get added, use TagCreationInfo metadata * * This method is provided as a utility for clients. It is not used by default * * @param element * @param creationData */ protected final void ensureRequiredAttrs(final Element element, final CreationData creationData) { CMElementDeclaration ed = CMUtil.getTLDElementDeclaration(creationData.getUri(), creationData.getTagName(), creationData.getModel().getDocument().getStructuredDocument()); if (ed != null) { for (Iterator it=ed.getAttributes().iterator();it.hasNext();){ CMAttributeDeclaration attr = (CMAttributeDeclaration)it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED && element.getAttribute(attr.getAttrName()) == null) { element.setAttribute(attr.getAttrName(), attr.getDefaultValue()); } } } }
private IPropertyDescriptor createTextPropertyDescriptor(CMAttributeDeclaration attrDecl) { TextPropertyDescriptor descriptor = new TextPropertyDescriptor(attrDecl.getAttrName(), attrDecl.getAttrName()); descriptor.setCategory(getCategory(attrDecl)); descriptor.setDescription(attrDecl.getAttrName()); if ((attrDecl.getUsage() != CMAttributeDeclaration.REQUIRED) && fSetExpertFilter) { descriptor.setFilterFlags(new String[]{IPropertySheetEntry.FILTER_ID_EXPERT}); } return descriptor; }
private void checkRequiredAttributes(IDOMElement element, CMNamedNodeMap attrMap, IReporter reporter, IFile file, IStructuredDocument document, IStructuredDocumentRegion documentRegion) { Iterator it = attrMap.iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); if (attr.getUsage() == CMAttributeDeclaration.REQUIRED) { Attr a = element.getAttributeNode(attr.getAttrName()); if (a == null) { String msgText = NLS.bind(JSPCoreMessages.JSPDirectiveValidator_5, attr.getAttrName()); LocalizedMessage message = new LocalizedMessage(fSeverityMissingRequiredAttribute, msgText, file); int start = element.getStartOffset(); int length = element.getStartEndOffset() - start; int lineNo = document.getLineOfOffset(start); message.setLineNo(lineNo); message.setOffset(start); message.setLength(length); reporter.addMessage(fMessageOriginator, message); } } } }
/** * Creates a property descriptor for an attribute with ENUMERATED values - * if the value does not exist, an editable combo box is returned - if the * value exists but is not one in the enumerated list of value, a combo * box featuring the current and correct values is returned - if the value * exists and it is a valid value, a combo box featuring the correct * values with the current one visible is returned */ private IPropertyDescriptor createEnumeratedPropertyDescriptor(CMAttributeDeclaration attrDecl, CMDataType valuesHelper) { // the displayName MUST be set EnumeratedStringPropertyDescriptor descriptor = new EnumeratedStringPropertyDescriptor(attrDecl.getAttrName(), attrDecl.getAttrName(), _getValidStrings(attrDecl, valuesHelper)); descriptor.setCategory(getCategory(attrDecl)); descriptor.setDescription(attrDecl.getAttrName()); if ((attrDecl.getUsage() != CMAttributeDeclaration.REQUIRED) && fSetExpertFilter) { descriptor.setFilterFlags(new String[]{IPropertySheetEntry.FILTER_ID_EXPERT}); } return descriptor; }
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; }
if (attrDecl.getUsage() == CMAttributeDeclaration.REQUIRED) { isRequired = XMLRelevanceConstants.R_REQUIRED;