當前位置: 首頁>>代碼示例>>Java>>正文


Java ICSSSimpleSelector類代碼示例

本文整理匯總了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);
        }
      }
    }
  }
}
 
開發者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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。