public synchronized void addStyle(DefaultSynthStyle style, String path, int type)
     throws PatternSyntaxException {
   if (path == null) {
     // Make an empty path match all.
     path = ".*";
   }
   if (type == NAME) {
     _styles.add(StyleAssociation.createStyleAssociation(path, style, type));
   } else if (type == REGION) {
     _styles.add(StyleAssociation.createStyleAssociation(path.toLowerCase(), style, type));
   }
 }
  /** Fetches any styles that match the passed into arguments into <code>matches</code>. */
  private void getMatchingStyles(java.util.List matches, JComponent c, Region id) {
    String idName = id.getLowerCaseName();
    String cName = c.getName();

    if (cName == null) {
      cName = "";
    }
    for (int counter = _styles.size() - 1; counter >= 0; counter--) {
      StyleAssociation sa = _styles.get(counter);
      String path;

      if (sa.getID() == NAME) {
        path = cName;
      } else {
        path = idName;
      }

      if (sa.matches(path) && matches.indexOf(sa.getStyle()) == -1) {
        matches.add(sa.getStyle());
      }
    }
  }