private ListItem[] createListModel() {
    ArrayList listModelItems = new ArrayList();
    for (int i = 0; i < fHyperlinkDetectorDescriptors.length; i++) {
      HyperlinkDetectorDescriptor desc = fHyperlinkDetectorDescriptors[i];
      HyperlinkDetectorTargetDescriptor target = desc.getTarget();

      int stateMask = fStore.getInt(desc.getId() + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
      String modifierKeys = getModifierString(stateMask);

      listModelItems.add(
          new ListItem(desc.getId(), desc.getName(), target.getName(), modifierKeys));
    }

    Comparator comparator =
        new Comparator() {
          /*
           * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
           */
          public int compare(Object o1, Object o2) {
            if (!(o2 instanceof ListItem)) return -1;
            if (!(o1 instanceof ListItem)) return 1;

            String label1 = ((ListItem) o1).name;
            String label2 = ((ListItem) o2).name;

            return Collator.getInstance().compare(label1, label2);
          }
        };
    Collections.sort(listModelItems, comparator);

    ListItem[] items = new ListItem[listModelItems.size()];
    listModelItems.toArray(items);
    return items;
  }
 public HyperlinkDetectorDelegate(
     HyperlinkDetectorDescriptor descriptor, IPreferenceStore preferenceStore) {
   this.descriptor = descriptor;
   if (preferenceStore != null) {
     stateMask =
         preferenceStore.getInt(
             descriptor.getId() + HyperlinkDetectorDescriptor.STATE_MASK_POSTFIX);
     enabled = !preferenceStore.getBoolean(descriptor.getId());
   }
 }
  public IHyperlink[] detectHyperlinks(
      ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
    if (!isEnabled()) {
      return null;
    }

    if (!createFailed && delegate == null) {
      try {
        delegate = descriptor.createHyperlinkDetector();
      } catch (CoreException ex) {
        createFailed = true;
      }
      if (delegate != null && context != null) {
        delegate.setContext(context);
      }
    }
    if (delegate != null) {
      return delegate.detectHyperlinks(textViewer, region, canShowMultipleHyperlinks);
    }

    return null;
  }