Search in sources :

Example 26 with CMDataType

use of org.eclipse.wst.xml.core.internal.contentmodel.CMDataType in project webtools.sourceediting by eclipse.

the class XMLGeneratorImpl method isBooleanAttr.

/**
 */
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()));
}
Also used : CMDataType(org.eclipse.wst.xml.core.internal.contentmodel.CMDataType) CMAttributeDeclaration(org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)

Aggregations

CMDataType (org.eclipse.wst.xml.core.internal.contentmodel.CMDataType)26 CMElementDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)12 CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)9 CMAttributeDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)7 CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)7 List (java.util.List)6 Element (org.w3c.dom.Element)6 ArrayList (java.util.ArrayList)5 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)5 Node (org.w3c.dom.Node)5 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)4 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)4 Iterator (java.util.Iterator)3 Vector (java.util.Vector)3 CMNodeList (org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList)3 IDOMElement (org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)3 NodeList (org.w3c.dom.NodeList)3 Image (org.eclipse.swt.graphics.Image)2 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)2 IStructuredDocumentRegion (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion)2