Search in sources :

Example 6 with StyleSheetList

use of org.w3c.dom.stylesheets.StyleSheetList in project webtools.sourceediting by eclipse.

the class CSSStyleSheetImpl method getOwnerRules.

/**
 * @return org.w3c.dom.css.CSSRuleList
 */
public org.w3c.dom.css.CSSRuleList getOwnerRules() {
    StyleSheetList list = getParentStyleSheets();
    if (list == null)
        return null;
    CSSRuleListImpl ruleList = new CSSRuleListImpl();
    for (int i = 0; i < list.getLength(); i++) {
        ImportRuleCollector trav = new ImportRuleCollector(this);
        trav.apply((ICSSStyleSheet) list.item(i));
        ruleList.nodes.addAll(trav.getRules());
    }
    return ruleList;
}
Also used : ImportRuleCollector(org.eclipse.wst.css.core.internal.util.ImportRuleCollector) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Example 7 with StyleSheetList

use of org.w3c.dom.stylesheets.StyleSheetList in project webtools.sourceediting by eclipse.

the class HTMLDocumentAdapter method getClasses.

/**
 */
public Enumeration getClasses() {
    StyleSheetList sheetList = getStyleSheets();
    int nSheets = sheetList.getLength();
    final ArrayList classes = new ArrayList();
    CSSClassTraverser traverser = new CSSClassTraverser();
    traverser.setTraverseImported(true);
    for (int i = 0; i < nSheets; i++) {
        org.w3c.dom.stylesheets.StyleSheet sheet = sheetList.item(i);
        if (sheet instanceof ICSSNode) {
            traverser.apply((ICSSNode) sheet);
        }
    }
    classes.addAll(traverser.getClassNames());
    return new Enumeration() {

        int i = 0;

        public boolean hasMoreElements() {
            return i < classes.size();
        }

        public Object nextElement() {
            return classes.get(i++);
        }
    };
}
Also used : StyleSheet(org.w3c.dom.stylesheets.StyleSheet) Enumeration(java.util.Enumeration) ArrayList(java.util.ArrayList) CSSClassTraverser(org.eclipse.wst.css.core.internal.util.CSSClassTraverser) ICSSNode(org.eclipse.wst.css.core.internal.provisional.document.ICSSNode) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Aggregations

StyleSheetList (org.w3c.dom.stylesheets.StyleSheetList)7 StyleSheet (org.w3c.dom.stylesheets.StyleSheet)5 ArrayList (java.util.ArrayList)3 Reader (java.io.Reader)2 StringReader (java.io.StringReader)2 ExtendedDocumentCSS (org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS)2 CSSEngine (org.eclipse.e4.ui.css.core.engine.CSSEngine)2 ICSSNode (org.eclipse.wst.css.core.internal.provisional.document.ICSSNode)2 IDOMModel (org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel)2 Element (org.w3c.dom.Element)2 DocumentStyle (org.w3c.dom.stylesheets.DocumentStyle)2 Collection (java.util.Collection)1 Enumeration (java.util.Enumeration)1 Iterator (java.util.Iterator)1 ICSSStyleListener (org.eclipse.wst.css.core.internal.event.ICSSStyleListener)1 CSSClassTraverser (org.eclipse.wst.css.core.internal.util.CSSClassTraverser)1 ImportRuleCollector (org.eclipse.wst.css.core.internal.util.ImportRuleCollector)1 ImportedCollector (org.eclipse.wst.css.core.internal.util.ImportedCollector)1 INodeAdapter (org.eclipse.wst.sse.core.internal.provisional.INodeAdapter)1 INodeNotifier (org.eclipse.wst.sse.core.internal.provisional.INodeNotifier)1