protected short preNode(ICSSNode node) {
   if (node.getNodeType() == ICSSNode.STYLERULE_NODE) {
     ICSSStyleRule rule = (ICSSStyleRule) node;
     ICSSSelectorList list = rule.getSelectors();
     Iterator it = list.getIterator();
     while (it.hasNext()) {
       Object obj = it.next();
       if (selectorsToAvoid != null && selectorsToAvoid.contains(obj)) continue;
       if (!selectors.contains(obj)) selectors.add(obj);
     }
     return TRAV_PRUNE;
   } else if (node.getNodeType() == ICSSNode.STYLESHEET_NODE) {
     return TRAV_CONT;
   }
   return TRAV_PRUNE;
 }
  public ISelection getInputSelection(IWorkbenchPart selectingPart, ISelection selection) {
    // remove UI refresh adapters
    if (fSelectedNotifiers != null) {
      for (int i = 0; i < fSelectedNotifiers.length; i++) {
        fSelectedNotifiers[i].removeAdapter(fRefreshAdapter);
      }
      fSelectedNotifiers = null;
    }

    ISelection preferredSelection = super.getInputSelection(selectingPart, selection);
    if (preferredSelection instanceof IStructuredSelection) {
      Object[] selectedObjects = new Object[((IStructuredSelection) selection).size()];
      System.arraycopy(
          ((IStructuredSelection) selection).toArray(),
          0,
          selectedObjects,
          0,
          selectedObjects.length);
      for (int i = 0; i < selectedObjects.length; i++) {
        if (selectedObjects[i] instanceof ICSSNode) {
          ICSSNode node = (ICSSNode) selectedObjects[i];
          while (node.getNodeType() == ICSSNode.PRIMITIVEVALUE_NODE
              || node.getNodeType() == ICSSNode.STYLEDECLITEM_NODE) {
            node = node.getParentNode();
            selectedObjects[i] = node;
          }
        }
      }

      /*
       * Add UI refresh adapters and remember notifiers for later removal
       */
      if (selectedObjects.length > 0) {
        List selectedNotifiers = new ArrayList(1);
        for (int i = 0; i < selectedObjects.length; i++) {
          if (selectedObjects[i] instanceof INodeNotifier) {
            selectedNotifiers.add(selectedObjects[i]);
            ((INodeNotifier) selectedObjects[i]).addAdapter(fRefreshAdapter);
          }
        }
        fSelectedNotifiers =
            (INodeNotifier[])
                selectedNotifiers.toArray(new INodeNotifier[selectedNotifiers.size()]);
      }
      preferredSelection = new StructuredSelection(selectedObjects);
    }
    return preferredSelection;
  }