Search in sources :

Example 46 with ICSSSelectorItem

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

the class CSSSelectorTest method testSelector39.

public void testSelector39() {
    ICSSSelectorList list = createSelectorList(".123f567");
    checkSelectorList(list, ".123f567", 1, 1);
    ICSSSelector selector;
    ICSSSelectorItem item;
    selector = list.getSelector(0);
    checkSelector(selector, ".123f567", 1, 100, 1);
    item = selector.getItem(0);
    checkSimpleSelector(item, "", true, 0, 1, 0, 0);
    checkSimpleSelectorClasses(item, new String[] { "123f567" });
}
Also used : ICSSSelectorList(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList) ICSSSelector(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Example 47 with ICSSSelectorItem

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

the class CSSSelector method getString.

/**
 * @return java.lang.String
 */
public String getString() {
    if (fCachedString == null) {
        StringBuffer buf = new StringBuffer();
        Iterator i = getIterator();
        while (i.hasNext()) {
            ICSSSelectorItem item = (ICSSSelectorItem) i.next();
            if (item instanceof CSSSelectorCombinator) {
                // Then, you dont have to append string..
                if (((CSSSelectorCombinator) item).getCombinatorType() != ICSSSelectorCombinator.DESCENDANT) {
                    // $NON-NLS-1$
                    buf.append(" ");
                    buf.append(item.getString());
                }
                // $NON-NLS-1$
                buf.append(" ");
            } else {
                buf.append(item.getString());
            }
        }
        fCachedString = buf.toString();
    }
    return fCachedString;
}
Also used : ICSSSelectorCombinator(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorCombinator) Iterator(java.util.Iterator) ICSSSelectorItem(org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)

Aggregations

ICSSSelectorItem (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem)47 ICSSSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector)42 ICSSSelectorList (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList)41 ICSSSimpleSelector (org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector)6 Iterator (java.util.Iterator)4 ICSSSelectorCombinator (org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorCombinator)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Element (org.w3c.dom.Element)1