本文整理匯總了Java中org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector類的典型用法代碼示例。如果您正苦於以下問題:Java ICSSSimpleSelector類的具體用法?Java ICSSSimpleSelector怎麽用?Java ICSSSimpleSelector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ICSSSimpleSelector類屬於org.eclipse.wst.css.core.internal.provisional.document包,在下文中一共展示了ICSSSimpleSelector類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitCssNode
import org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector; //導入依賴的package包/類
public void visitCssNode(ICSSNode cssNode) {
ICSSSelectorList selectors;
switch (cssNode.getNodeType()) {
case ICSSNode.STYLERULE_NODE:
selectors = ((ICSSStyleRule) cssNode).getSelectors();
break;
case ICSSNode.PAGERULE_NODE:
// @Sprite is masked as a page rule
selectors = ((ICSSPageRule) cssNode).getSelectors();
break;
default:
// Not a node type that contains selectors
return;
}
for (int selectorPos = 0; selectorPos < selectors.getLength(); selectorPos++) {
ICSSSelector selector = selectors.getSelector(selectorPos);
for (int itemPos = 0; itemPos < selector.getLength(); itemPos++) {
ICSSSelectorItem item = selector.getItem(itemPos);
if (item.getItemType() == ICSSSelectorItem.SIMPLE) {
ICSSSimpleSelector simpleItem = (ICSSSimpleSelector) item;
for (int classPos = 0; classPos < simpleItem.getNumOfClasses(); classPos++) {
String name = simpleItem.getClass(classPos);
selectorNames.add(name);
}
}
}
}
}
示例2: traverseRule
import org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector; //導入依賴的package包/類
private void traverseRule(ICSSStyleRule rule) {
ICSSSelectorList selectorList = rule.getSelectors();
Iterator iSelector = selectorList.getIterator();
while (iSelector.hasNext()) {
ICSSSelector selector = (ICSSSelector) iSelector.next();
Iterator iItem = selector.getIterator();
while (iItem.hasNext() && !stop) {
ICSSSelectorItem item = (ICSSSelectorItem) iItem.next();
if (item.getItemType() == ICSSSelectorItem.SIMPLE) {
ICSSSimpleSelector sel = (ICSSSimpleSelector) item;
// vist CSS#class names
if (webResourcesType == WebResourcesFinderType.CSS_CLASS_NAME) {
int nClasses = sel.getNumOfClasses();
for (int iClass = 0; iClass < nClasses; iClass++) {
String className = sel.getClass(iClass);
if (collect(className, rule)) {
stop = true;
}
}
}
// visit CSS#id
if (webResourcesType == WebResourcesFinderType.CSS_ID) {
int nbIds = sel.getNumOfIDs();
for (int i = 0; i < nbIds; i++) {
String cssID = sel.getID(i);
if (collect(cssID, rule)) {
stop = true;
}
}
}
}
}
}
}