本文整理汇总了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;
}
}
}
}
}
}
}