Search in sources :

Example 51 with ICSSSelector

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.

the class CSSSelectorListImpl method parseSelectorText.

/**
 */
private void parseSelectorText() {
    fSelectors = new ArrayList();
    if (fText == null) {
        return;
    }
    CSSTextParser parser = new CSSTextParser(CSSTextParser.MODE_STYLESHEET, fText);
    CSSTextToken[] tokens = parser.getTokens();
    if (tokens.length <= 0) {
        return;
    }
    List tokenGroup = new ArrayList();
    for (int i = 0; i < tokens.length; i++) {
        CSSTextToken token = tokens[i];
        if (token.kind == CSSRegionContexts.CSS_SELECTOR_SEPARATOR && 0 < tokenGroup.size()) {
            ICSSSelector selector = new CSSSelector(tokenGroup);
            if (selector != null) {
                fSelectors.add(selector);
            }
            tokenGroup.clear();
        } else {
            tokenGroup.add(tokens[i]);
        }
    }
    if (0 < tokenGroup.size()) {
        ICSSSelector selector = new CSSSelector(tokenGroup);
        if (selector != null) {
            fSelectors.add(selector);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) CSSTextToken(org.eclipse.wst.css.core.internal.parserz.CSSTextToken) List(java.util.List) ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ArrayList(java.util.ArrayList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) CSSTextParser(org.eclipse.wst.css.core.internal.parserz.CSSTextParser)

Example 52 with ICSSSelector

use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.

the class CSSSelectorListImpl method getErrors.

/**
 */
public Iterator getErrors() {
    List errors = new ArrayList();
    Iterator iSelector = getSelectors().iterator();
    while (iSelector.hasNext()) {
        Iterator iError = ((ICSSSelector) iSelector.next()).getErrors();
        while (iError.hasNext()) {
            errors.add(iError.next());
        }
    }
    return errors.iterator();
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ArrayList(java.util.ArrayList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector)

Aggregations

ICSSSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector)52 ICSSSelectorList (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList)48 ICSSSelectorItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)42 Iterator (java.util.Iterator)7 ICSSStyleRule (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule)3 ImportedCollector (org.eclipse.wst.css.core.internal.util.ImportedCollector)3 SelectorsCollector (org.eclipse.wst.css.core.internal.util.SelectorsCollector)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ICSSNode (org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)2 ICSSSimpleSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector)2 ICSSStyleSheet (org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet)2 Vector (java.util.Vector)1 CSSTextParser (org.eclipse.wst.css.core.internal.parserz.CSSTextParser)1 CSSTextToken (org.eclipse.wst.css.core.internal.parserz.CSSTextToken)1 ICSSImportRule (org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule)1 ICSSValue (org.eclipse.wst.css.core.internal.provisional.document.ICSSValue)1 ImportRuleCollector (org.eclipse.wst.css.core.internal.util.ImportRuleCollector)1