当前位置: 首页>>代码示例>>Java>>正文


Java ICSSSimpleSelector.getNumOfClasses方法代码示例

本文整理汇总了Java中org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector.getNumOfClasses方法的典型用法代码示例。如果您正苦于以下问题:Java ICSSSimpleSelector.getNumOfClasses方法的具体用法?Java ICSSSimpleSelector.getNumOfClasses怎么用?Java ICSSSimpleSelector.getNumOfClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector的用法示例。


在下文中一共展示了ICSSSimpleSelector.getNumOfClasses方法的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);
        }
      }
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:32,代码来源:CssSelectorNameCollector.java

示例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;
						}
					}
				}
			}
		}
	}
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-webresources,代码行数:35,代码来源:AbstractCSSClassNameOrIdTraverser.java


注:本文中的org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector.getNumOfClasses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。