use of org.w3c.dom.stylesheets.StyleSheet 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);
}
}
use of org.w3c.dom.stylesheets.StyleSheet in project webtools.sourceediting by eclipse.
the class HTMLDocumentAdapter method item.
/**
*/
public StyleSheet item(int index) {
if (this.styleAdapters == null)
return null;
List validAdapters = getValidAdapters();
if (index < 0 || index >= validAdapters.size())
return null;
StyleSheet sheet = ((IStyleSheetAdapter) validAdapters.get(index)).getSheet();
if (sheet == null) {
// for LINK element whose link is broken
ICSSModel model = ((AbstractStyleSheetAdapter) validAdapters.get(index)).createModel();
sheet = ((model != null) ? (StyleSheet) model.getDocument() : null);
}
return sheet;
}
use of org.w3c.dom.stylesheets.StyleSheet 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);
}
}
Aggregations