use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.
the class CSSSelectorTest method testSelector20.
public void testSelector20() {
ICSSSelectorList list = createSelectorList("SPAN[hello=\"Cleveland\"][goodbye=\"Columbus\"]");
checkSelectorList(list, "SPAN[hello=\"Cleveland\"][goodbye=\"Columbus\"]", 1, 0);
ICSSSelector selector;
ICSSSelectorItem item;
selector = list.getSelector(0);
checkSelector(selector, "SPAN[hello=\"Cleveland\"][goodbye=\"Columbus\"]", 1, 201, 0);
item = selector.getItem(0);
checkSimpleSelector(item, "SPAN", false, 2, 0, 0, 0);
checkSimpleSelectorAttributes(item, new String[] { "hello=\"Cleveland\"", "goodbye=\"Columbus\"" });
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.
the class CSSSelectorTest method testSelector06.
public void testSelector06() {
ICSSSelectorList list = createSelectorList(".warning");
checkSelectorList(list, ".warning", 1, 0);
ICSSSelector selector;
ICSSSelectorItem item;
selector = list.getSelector(0);
checkSelector(selector, ".warning", 1, 100, 0);
item = selector.getItem(0);
checkSimpleSelector(item, "", true, 0, 1, 0, 0);
checkSimpleSelectorClasses(item, new String[] { "warning" });
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector 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" });
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.
the class CSSStyleNotifyAdapter method addStyleListener.
/**
*/
public void addStyleListener(ICSSStyleListener listener) {
if (listener == null)
return;
if (listeners == null)
listeners = new Vector();
if (!listeners.contains(listener)) {
// send new selectors event to listener
ImportedCollector trav = new ImportedCollector();
trav.apply(model.getDocument());
Iterator it = trav.getExternals().iterator();
while (it.hasNext()) {
ICSSStyleSheet sheet = (ICSSStyleSheet) it.next();
// collect selectors
SelectorsCollector selTrav = new SelectorsCollector();
selTrav.apply(sheet);
int nSel = selTrav.getSelectors().size();
ICSSSelector[] added = new ICSSSelector[nSel];
for (int i = 0; i < nSel; i++) added[i] = (ICSSSelector) selTrav.getSelectors().get(i);
// fire event
CSSStyleEventDeliverer deliverer = new CSSStyleEventDeliverer();
deliverer.fireTo(listener, sheet.getModel(), null, added, null);
}
// add listener
listeners.add(listener);
}
}
use of org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector in project webtools.sourceediting by eclipse.
the class CSSStyleNotifyAdapter method removeStyleListener.
/**
*/
public void removeStyleListener(ICSSStyleListener listener) {
if (listener == null)
return;
if (listeners.contains(listener)) {
listeners.remove(listener);
// send old selectors event to listener
ImportedCollector trav = new ImportedCollector();
trav.apply(model.getDocument());
Iterator it = trav.getExternals().iterator();
while (it.hasNext()) {
ICSSStyleSheet sheet = (ICSSStyleSheet) it.next();
// collect selectors
SelectorsCollector selTrav = new SelectorsCollector();
selTrav.apply(sheet);
int nSel = selTrav.getSelectors().size();
ICSSSelector[] removed = new ICSSSelector[nSel];
for (int i = 0; i < nSel; i++) removed[i] = (ICSSSelector) selTrav.getSelectors().get(i);
// fire event
CSSStyleEventDeliverer deliverer = new CSSStyleEventDeliverer();
deliverer.fireTo(listener, sheet.getModel(), removed, null, null);
}
}
}
Aggregations