/**
  * Verifies if the given element matches one of the selection requirements. Element must at least
  * pass the type test, and optionally wildcard name match.
  */
 private boolean verifyElement(IAdaptable element) {
   if (classes.isEmpty()) {
     return true;
   }
   for (int i = 0; i < classes.size(); i++) {
     SelectionClass sc = (SelectionClass) classes.get(i);
     if (verifyClass(element, sc.className) == false) {
       continue;
     }
     if (sc.nameFilter == null) {
       return true;
     }
     IWorkbenchAdapter de = (IWorkbenchAdapter) Util.getAdapter(element, IWorkbenchAdapter.class);
     if ((de != null) && verifyNameMatch(de.getLabel(element), sc.nameFilter)) {
       return true;
     }
   }
   return false;
 }
  /**
   * Returns true if given text selection matches the conditions specified in the registry for this
   * action.
   */
  private boolean isEnabledFor(ISelection sel, int count) {
    if (verifySelectionCount(count) == false) {
      return false;
    }

    // Compare selection to enablement expression.
    if (enablementExpression != null) {
      return enablementExpression.isEnabledFor(sel);
    }

    // Compare selection to class requirements.
    if (classes.isEmpty()) {
      return true;
    }
    for (int i = 0; i < classes.size(); i++) {
      SelectionClass sc = (SelectionClass) classes.get(i);
      if (verifyClass(sel, sc.className)) {
        return true;
      }
    }
    return false;
  }