/** */ public String generateAttrName(Attr attr) { if (attr == null) return null; String attrName = attr.getName(); if (attrName == null) return null; if (attrName.startsWith(JSPTag.TAG_OPEN)) { if (!attrName.endsWith(JSPTag.TAG_CLOSE)) { // close JSP return (attrName + JSPTag.TAG_CLOSE); } } if (((IDOMAttr) attr).isGlobalAttr() && CMNodeUtil.getAttributeDeclaration(attr) != null) { switch (getAttrNameCase(attr)) { case DocumentTypeAdapter.UPPER_CASE : attrName = attrName.toUpperCase(); break; case DocumentTypeAdapter.LOWER_CASE : attrName = attrName.toLowerCase(); break; default : // ASIS_CASE break; } } return attrName; }
CMNodeUtil.getElementDeclaration(xe) != null) { String newName = tagName; switch (getTagNameCase(xe)) {
IDOMElement childElement = (IDOMElement) child; CMElementDeclaration myDec = CMNodeUtil.getElementDeclaration(element); if (myDec == null) return true; CMElementDeclaration childDec = CMNodeUtil.getElementDeclaration(childElement); if (childDec == null) return true;
@Override protected void doCollect(IDOMElement target, String name, IFile file, INgBindingCollector collector) { String tagName = target.getTagName(); int index = name.lastIndexOf('.'); if (index != -1) { String part = name.substring(0, index); if (ATTR_PROP.equals(part)) { // completion for attributes CMElementDeclaration eltDecl = CMNodeUtil.getElementDeclaration(target); if (eltDecl != null) { Iterator it = eltDecl.getAttributes().iterator(); CMAttributeDeclaration attr = null; while (it.hasNext()) { attr = (CMAttributeDeclaration) it.next(); collector.collect(name, part + "." + attr.getAttrName(), null, this); } } } } else { DomElementSchemaRegistry.INSTANCE.collectProperty(tagName, DomElementSchemaRegistry.INSTANCE.getMappedPropName(name), this, collector); collector.collect(name, ATTR_PROP, formatAttr(ATTR_PROP), this); collector.collect(name, CLASS_PROP, formatAttr(CLASS_PROP), this); } // style already exists } }
/** */ 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())); } }