/**
   * Parses registry element to extract mode and selection elements that will be used for
   * verification.
   */
  private void parseClasses(IConfigurationElement config) {
    // Get enables for.
    String enablesFor = config.getAttribute(IWorkbenchRegistryConstants.ATT_ENABLES_FOR);
    if (enablesFor == null) {
      enablesFor = "*"; // $NON-NLS-1$
    }
    if (enablesFor.equals("*")) { // $NON-NLS-1$
      mode = ANY_NUMBER;
    } else if (enablesFor.equals("?")) { // $NON-NLS-1$
      mode = NONE_OR_ONE;
    } else if (enablesFor.equals("!")) { // $NON-NLS-1$
      mode = NONE;
    } else if (enablesFor.equals("+")) { // $NON-NLS-1$
      mode = ONE_OR_MORE;
    } else if (enablesFor.equals("multiple") // $NON-NLS-1$
        || enablesFor.equals("2+")) { // $NON-NLS-1$
      mode = MULTIPLE;
    } else {
      try {
        mode = Integer.parseInt(enablesFor);
      } catch (NumberFormatException e) {
        mode = UNKNOWN;
      }
    }

    // Get enablement block.
    IConfigurationElement[] children =
        config.getChildren(IWorkbenchRegistryConstants.TAG_ENABLEMENT);
    if (children.length > 0) {
      enablementExpression = new ActionExpression(children[0]);
      return;
    }

    // Get selection block.
    children = config.getChildren(IWorkbenchRegistryConstants.TAG_SELECTION);
    if (children.length > 0) {
      classes = new ArrayList();
      for (int i = 0; i < children.length; i++) {
        IConfigurationElement sel = children[i];
        String cname = sel.getAttribute(IWorkbenchRegistryConstants.ATT_CLASS);
        String name = sel.getAttribute(IWorkbenchRegistryConstants.ATT_NAME);
        SelectionClass sclass = new SelectionClass();
        sclass.className = cname;
        sclass.nameFilter = name;
        classes.add(sclass);
      }
    }
  }