use of org.w3c.css.sac.SelectorList in project eclipse.pde by eclipse-pde.
the class CssSpyPart method performCSSSearch.
private void performCSSSearch(IProgressMonitor monitor, String text, Collection<Widget> results) {
if (text.trim().length() == 0) {
return;
}
widgetTreeViewer.collapseAll();
Object[] roots = widgetTreeProvider.getElements(widgetTreeViewer.getInput());
SubMonitor subMonitor = SubMonitor.convert(monitor, MessageFormat.format(Messages.CssSpyPart_Searching_for, text), roots.length * 10);
for (Object root : roots) {
if (monitor.isCanceled()) {
return;
}
CSSStylableElement element = getCSSElement(root);
if (element == null) {
continue;
}
CSSEngine engine = getCSSEngine(root);
try {
SelectorList selectors = engine.parseSelectors(text);
subMonitor.split(2);
processCSSSearch(subMonitor.split(8), engine, selectors, element, null, results);
} catch (CSSParseException | IOException e) {
System.out.println(e.toString());
}
}
monitor.done();
}
use of org.w3c.css.sac.SelectorList in project org.eclipse.rap by eclipse-rap.
the class StyleSheet method toString.
@Override
public String toString() {
StringBuilder buffer = new StringBuilder();
StyleRule[] styleRules = getStyleRules();
for (int i = 0; i < styleRules.length; i++) {
StyleRule styleRule = styleRules[i];
SelectorList selectors = styleRule.getSelectors();
int length = selectors.getLength();
for (int j = 0; j < length; j++) {
if (j > 0) {
buffer.append(",");
}
if (i > 0) {
buffer.append("\n");
}
buffer.append(selectors.item(j));
}
buffer.append("\n");
buffer.append(styleRule.getProperties());
buffer.append("\n");
}
return buffer.toString();
}
use of org.w3c.css.sac.SelectorList in project org.eclipse.rap by eclipse-rap.
the class StyleSheet method createSelectorWrappers.
private void createSelectorWrappers() {
List<SelectorWrapper> selectorWrappersList = new LinkedList<>();
for (int pos = 0; pos < styleRules.length; pos++) {
StyleRule styleRule = styleRules[pos];
SelectorList selectors = styleRule.getSelectors();
StylePropertyMap properties = styleRule.getProperties();
int length = selectors.getLength();
for (int i = 0; i < length; i++) {
Selector selector = selectors.item(i);
SelectorWrapper selectorWrapper = new SelectorWrapper(selector, properties, pos);
selectorWrappersList.add(selectorWrapper);
}
}
Collections.sort(selectorWrappersList, COMPARATOR);
Collections.reverse(selectorWrappersList);
selectorWrappers = new SelectorWrapper[selectorWrappersList.size()];
selectorWrappersList.toArray(selectorWrappers);
}
use of org.w3c.css.sac.SelectorList in project org.eclipse.rap by eclipse-rap.
the class Parser method parseSelectorsInternal.
/**
* Parses selectors using the current scanner.
*/
protected SelectorList parseSelectorsInternal() throws CSSException, IOException {
nextIgnoreSpaces();
SelectorList ret = parseSelectorList();
scanner = null;
return ret;
}
use of org.w3c.css.sac.SelectorList in project org.eclipse.rap by eclipse-rap.
the class ThemeTestBase method processTestStyleRule.
private static void processTestStyleRule(StyleRule styleRule) {
SelectorList selectors = styleRule.getSelectors();
StylePropertyMap properties = styleRule.getProperties();
int length = selectors.getLength();
for (int i = 0; i < length; i++) {
Selector selector = selectors.item(i);
SelectorExt selectorExt = (SelectorExt) selector;
checkProperties(selectorExt, properties);
}
}
Aggregations