Search in sources :

Example 1 with CSSMMTypeCollector

use of org.eclipse.wst.css.core.internal.metamodel.util.CSSMMTypeCollector in project webtools.sourceediting by eclipse.

the class CSSProposalGeneratorForPseudoSelector method getSelectorTags.

/**
 */
List getSelectorTags() {
    List tagList = new ArrayList();
    ICSSNode targetNode = fContext.getTargetNode();
    String rootType = (targetNode instanceof ICSSPageRule) ? CSSMMNode.TYPE_PAGE_RULE : CSSMMNode.TYPE_STYLE_RULE;
    CSSMMTypeCollector collector = new CSSMMTypeCollector();
    collector.collectNestedType(false);
    collector.apply(fContext.getMetaModel(), rootType);
    Iterator i;
    i = collector.getNodes();
    if (!i.hasNext()) {
        return tagList;
    }
    CSSMMNode node = (CSSMMNode) i.next();
    i = node.getChildNodes();
    while (i.hasNext()) {
        CSSMMNode child = (CSSMMNode) i.next();
        if (child.getType() == CSSMMNode.TYPE_SELECTOR) {
            String selType = ((CSSMMSelector) child).getSelectorType();
            if (selType == CSSMMSelector.TYPE_PSEUDO_CLASS || selType == CSSMMSelector.TYPE_PSEUDO_ELEMENT) {
                tagList.add(child);
            }
        }
    }
    return tagList;
}
Also used : CSSMMNode(org.eclipse.wst.css.core.internal.metamodel.CSSMMNode) ICSSPageRule(org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule) CSSMMTypeCollector(org.eclipse.wst.css.core.internal.metamodel.util.CSSMMTypeCollector) CSSMMSelector(org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) ICSSNode(org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)

Aggregations

ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 List (java.util.List)1 CSSMMNode (org.eclipse.wst.css.core.internal.metamodel.CSSMMNode)1 CSSMMSelector (org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector)1 CSSMMTypeCollector (org.eclipse.wst.css.core.internal.metamodel.util.CSSMMTypeCollector)1 ICSSNode (org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)1 ICSSPageRule (org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule)1