Search in sources :

Example 1 with ExtendedDocumentCSS

use of org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS in project dbeaver by serge-rider.

the class ApplicationCSSManager method updateApplicationCSS.

static void updateApplicationCSS(Display display) {
    CSSEngine engine = WidgetElement.getEngine(display);
    if (engine == null) {
        log.error("No CSSEngine");
        return;
    }
    ExtendedDocumentCSS doc = (ExtendedDocumentCSS) engine.getDocumentCSS();
    List<StyleSheet> sheets = new ArrayList<>();
    StyleSheetList list = doc.getStyleSheets();
    for (int i = 0; i < list.getLength(); i++) {
        sheets.add(list.item(i));
    }
    try {
        Reader reader = new StringReader(EXTRA_CSS);
        sheets.add(engine.parseStyleSheet(reader));
        doc.removeAllStyleSheets();
        for (StyleSheet sheet : sheets) {
            doc.addStyleSheet(sheet);
        }
        engine.reapply();
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : StyleSheet(org.w3c.dom.stylesheets.StyleSheet) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) CSSEngine(org.eclipse.e4.ui.css.core.engine.CSSEngine) StringReader(java.io.StringReader) Reader(java.io.Reader) ExtendedDocumentCSS(org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Example 2 with ExtendedDocumentCSS

use of org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS in project dbeaver by dbeaver.

the class ApplicationCSSManager method updateApplicationCSS.

static void updateApplicationCSS(Display display) {
    CSSEngine engine = WidgetElement.getEngine(display);
    if (engine == null) {
        log.error("No CSSEngine");
        return;
    }
    ExtendedDocumentCSS doc = (ExtendedDocumentCSS) engine.getDocumentCSS();
    List<StyleSheet> sheets = new ArrayList<>();
    StyleSheetList list = doc.getStyleSheets();
    for (int i = 0; i < list.getLength(); i++) {
        sheets.add(list.item(i));
    }
    try {
        Reader reader = new StringReader(TABBED_FOLDER_STYLE);
        sheets.add(engine.parseStyleSheet(reader));
        doc.removeAllStyleSheets();
        for (StyleSheet sheet : sheets) {
            doc.addStyleSheet(sheet);
        }
    // engine.reapply();
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : StyleSheet(org.w3c.dom.stylesheets.StyleSheet) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) CSSEngine(org.eclipse.e4.ui.css.core.engine.CSSEngine) StringReader(java.io.StringReader) Reader(java.io.Reader) ExtendedDocumentCSS(org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Example 3 with ExtendedDocumentCSS

use of org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS in project dbeaver by dbeaver.

the class ApplicationCSSManager method updateApplicationCSS.

static void updateApplicationCSS(Display display) {
    CSSEngine engine = WidgetElement.getEngine(display);
    if (engine == null) {
        log.error("No CSSEngine");
        return;
    }
    ExtendedDocumentCSS doc = (ExtendedDocumentCSS) engine.getDocumentCSS();
    List<StyleSheet> sheets = new ArrayList<>();
    StyleSheetList list = doc.getStyleSheets();
    for (int i = 0; i < list.getLength(); i++) {
        sheets.add(list.item(i));
    }
    try {
        Reader reader = new StringReader(EXTRA_CSS);
        sheets.add(engine.parseStyleSheet(reader));
        doc.removeAllStyleSheets();
        for (StyleSheet sheet : sheets) {
            doc.addStyleSheet(sheet);
        }
        engine.reapply();
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : StyleSheet(org.w3c.dom.stylesheets.StyleSheet) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) CSSEngine(org.eclipse.e4.ui.css.core.engine.CSSEngine) StringReader(java.io.StringReader) Reader(java.io.Reader) ExtendedDocumentCSS(org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Example 4 with ExtendedDocumentCSS

use of org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS in project dbeaver by serge-rider.

the class ApplicationCSSManager method updateApplicationCSS.

static void updateApplicationCSS(Display display) {
    CSSEngine engine = WidgetElement.getEngine(display);
    if (engine == null) {
        log.error("No CSSEngine");
        return;
    }
    ExtendedDocumentCSS doc = (ExtendedDocumentCSS) engine.getDocumentCSS();
    List<StyleSheet> sheets = new ArrayList<>();
    StyleSheetList list = doc.getStyleSheets();
    for (int i = 0; i < list.getLength(); i++) {
        sheets.add(list.item(i));
    }
    try {
        Reader reader = new StringReader(TABBED_FOLDER_STYLE);
        sheets.add(engine.parseStyleSheet(reader));
        doc.removeAllStyleSheets();
        for (StyleSheet sheet : sheets) {
            doc.addStyleSheet(sheet);
        }
    // engine.reapply();
    } catch (Exception e) {
        log.error(e);
    }
}
Also used : StyleSheet(org.w3c.dom.stylesheets.StyleSheet) ArrayList(java.util.ArrayList) StringReader(java.io.StringReader) CSSEngine(org.eclipse.e4.ui.css.core.engine.CSSEngine) StringReader(java.io.StringReader) Reader(java.io.Reader) ExtendedDocumentCSS(org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS) StyleSheetList(org.w3c.dom.stylesheets.StyleSheetList)

Aggregations

Reader (java.io.Reader)4 StringReader (java.io.StringReader)4 ArrayList (java.util.ArrayList)4 ExtendedDocumentCSS (org.eclipse.e4.ui.css.core.dom.ExtendedDocumentCSS)4 CSSEngine (org.eclipse.e4.ui.css.core.engine.CSSEngine)4 StyleSheet (org.w3c.dom.stylesheets.StyleSheet)4 StyleSheetList (org.w3c.dom.stylesheets.StyleSheetList)4