public Menu getMenu(Control parent) {
    XMLPlugin plugin = XMLPlugin.getDefault();
    Menu menu = new Menu(parent);
    addActionToMenu(menu, new SelectMatcherAction(XMLStructureCreator.USE_UNORDERED, fViewer));
    addActionToMenu(menu, new SelectMatcherAction(XMLStructureCreator.USE_ORDERED, fViewer));
    new MenuItem(menu, SWT.SEPARATOR);
    HashMap IdMaps = plugin.getIdMaps();
    HashMap IdMapsInternal = plugin.getIdMapsInternal();

    Set keySetIdMaps = IdMaps.keySet();
    Set keySetIdMapsInternal = IdMapsInternal.keySet();
    ArrayList internalIdMapsAL = new ArrayList();
    for (Iterator iter_internal = keySetIdMapsInternal.iterator(); iter_internal.hasNext(); ) {
      String idmap_name = (String) iter_internal.next();
      internalIdMapsAL.add(idmap_name);
    }
    Object[] internalIdMapsA = internalIdMapsAL.toArray();
    Arrays.sort(internalIdMapsA);
    for (int i = 0; i < internalIdMapsA.length; i++) {
      addActionToMenu(menu, new SelectMatcherAction((String) internalIdMapsA[i], fViewer));
    }
    new MenuItem(menu, SWT.SEPARATOR);

    ArrayList userIdMapsAL = new ArrayList();
    for (Iterator iter_idmaps = keySetIdMaps.iterator(); iter_idmaps.hasNext(); ) {
      String idmap_name = (String) iter_idmaps.next();
      userIdMapsAL.add(idmap_name);
    }

    HashMap OrderedElements = plugin.getOrderedElements();
    Set keySetOrdered = OrderedElements.keySet();
    for (Iterator iter_orderedElements = keySetOrdered.iterator();
        iter_orderedElements.hasNext(); ) {
      String idmap_name = (String) iter_orderedElements.next();
      if (!keySetIdMaps.contains(idmap_name)) {
        userIdMapsAL.add(idmap_name);
      }
    }

    Object[] userIdMapsA = userIdMapsAL.toArray();
    Arrays.sort(userIdMapsA);
    for (int i = 0; i < userIdMapsA.length; i++) {
      addActionToMenu(menu, new SelectMatcherAction((String) userIdMapsA[i], fViewer));
    }

    return menu;
  }
 public ChooseMatcherDropDownAction(XMLStructureViewer viewer) {
   fViewer = viewer;
   setText(XMLCompareMessages.ChooseMatcherDropDownAction_text);
   setImageDescriptor(
       XMLPlugin.getDefault().getImageDescriptor("obj16/smartmode_co.gif")); // $NON-NLS-1$
   setToolTipText(XMLCompareMessages.ChooseMatcherDropDownAction_tooltip);
   setMenuCreator(this);
 }