Search in sources :

Example 96 with CMNode

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

the class CtdTable method createContent.

/**
 * (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)
 * --> ((CAPTION)?, ((COL)* | (COLGROUP)*), (THEAD)?, (TFOOT)?, (TBODY)+, (TR)+)
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( , , , ,)
    content = new CMGroupImpl(CMGroup.SEQUENCE, 1, 1);
    // (CAPTION)?
    // ( )?
    CMGroupImpl wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
    if (wrap == null)
        return;
    content.appendChild(wrap);
    // CAPTION
    CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.CAPTION);
    if (dec != null)
        wrap.appendChild(dec);
    // ((COL)* | (COLGROUP)*)
    // ( | )
    CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
    if (group == null)
        return;
    content.appendChild(group);
    // (COL)*
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
    if (wrap == null)
        return;
    group.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.COL);
    if (dec != null)
        wrap.appendChild(dec);
    // (COLGROUP)*
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
    if (wrap == null)
        return;
    group.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.COLGROUP);
    if (dec != null)
        wrap.appendChild(dec);
    // (THEAD)?
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
    if (wrap == null)
        return;
    content.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.THEAD);
    if (dec != null)
        wrap.appendChild(dec);
    // (TFOOT)?
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
    if (wrap == null)
        return;
    content.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.TFOOT);
    if (dec != null)
        wrap.appendChild(dec);
    // (TBODY)+
    // TBODY has optional start and end tags
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 0, CMContentImpl.UNBOUNDED);
    if (wrap == null)
        return;
    content.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.TBODY);
    if (dec != null)
        wrap.appendChild(dec);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=96101
    // TBODY start and end tag are optional, so TR should be allowed here
    // (TR)+
    wrap = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
    if (wrap == null)
        return;
    content.appendChild(wrap);
    dec = collection.getNamedItem(HTML40Namespace.ElementName.TR);
    if (dec != null)
        wrap.appendChild(dec);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 97 with CMNode

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

the class AttributeCollection method getDeclaration.

/**
 * Get a global attribute declaration.
 *
 * @param attrName
 *            java.lang.String
 */
public HTMLAttributeDeclaration getDeclaration(String attrName) {
    CMNode cmnode = getNamedItem(attrName);
    if (cmnode != null)
        // already exists.
        return (HTMLAttributeDeclaration) cmnode;
    HTMLAttrDeclImpl dec = create(attrName);
    if (dec != null)
        putNamedItem(attrName, dec);
    return dec;
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 98 with CMNode

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

the class CtdTrContainer method createContent.

/**
 * (TR)+.
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // (TR)+
    content = new CMGroupImpl(CMGroup.SEQUENCE, 1, CMContentImpl.UNBOUNDED);
    CMNode tr = collection.getNamedItem(HTML40Namespace.ElementName.TR);
    if (tr != null)
        content.appendChild(tr);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 99 with CMNode

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

the class CtdFrameset method createContent.

/**
 * ((FRAMESET | FRAME)+ & NOFRAMES?).
 * --> ((FRAMESET | FRAME)+ & (NOFRAMES)?)
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( & )
    content = new CMGroupImpl(CMGroup.ALL, 1, 1);
    // ( | )+
    CMGroupImpl group = new CMGroupImpl(CMGroup.CHOICE, 1, CMContentImpl.UNBOUNDED);
    if (group == null)
        return;
    content.appendChild(group);
    // FRAMESET
    CMNode dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAMESET);
    if (dec != null)
        group.appendChild(dec);
    // FRAME
    dec = collection.getNamedItem(HTML40Namespace.ElementName.FRAME);
    if (dec != null)
        group.appendChild(dec);
    // ( )?
    group = new CMGroupImpl(CMGroup.SEQUENCE, 0, 1);
    if (group == null)
        return;
    content.appendChild(group);
    // NOFRAMES
    dec = collection.getNamedItem(HTML40Namespace.ElementName.NOFRAMES);
    if (dec != null)
        group.appendChild(dec);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Example 100 with CMNode

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

the class CtdParamContainer method createContent.

/**
 * (PARAM | %flow;)*.
 */
protected void createContent() {
    if (content != null)
        // already created.
        return;
    if (collection == null)
        return;
    // ( | )*
    content = new CMGroupImpl(CMGroup.CHOICE, 0, CMContentImpl.UNBOUNDED);
    // PARAM
    CMNode param = collection.getNamedItem(HTML40Namespace.ElementName.PARAM);
    if (param != null)
        content.appendChild(param);
    // %flow;
    CMGroupImpl flows = new CMGroupImpl(CMGroup.CHOICE, 1, 1);
    if (flows == null)
        return;
    collection.getInline(flows);
    collection.getBlock(flows);
    content.appendChild(flows);
}
Also used : CMNode(org.eclipse.wst.xml.core.internal.contentmodel.CMNode)

Aggregations

CMNode (org.eclipse.wst.xml.core.internal.contentmodel.CMNode)133 CMElementDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)37 List (java.util.List)36 CMNamedNodeMap (org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap)35 ArrayList (java.util.ArrayList)28 Iterator (java.util.Iterator)23 ITextRegionList (org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList)20 CMNodeList (org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList)19 CMAttributeDeclaration (org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration)17 CMDocument (org.eclipse.wst.xml.core.internal.contentmodel.CMDocument)17 Element (org.w3c.dom.Element)16 NodeList (org.w3c.dom.NodeList)15 CMNamedNodeMapImpl (org.eclipse.wst.xml.core.internal.contentmodel.basic.CMNamedNodeMapImpl)14 ModelQuery (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery)13 Node (org.w3c.dom.Node)13 NamedNodeMap (org.w3c.dom.NamedNodeMap)10 ModelQueryAction (org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQueryAction)9 IDOMNode (org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode)9 Image (org.eclipse.swt.graphics.Image)8 CustomCompletionProposal (org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal)8