/**
   * Method to return an array list containing plugins of a certain editor type and category
   *
   * @param editorType The editor type
   * @param category The category
   * @return An array list of any plugins found
   */
  public ArrayList<ATPlugin> getEmbeddedEditorPlugins(String editorType, String category) {
    ArrayList<ATPlugin> foundPlugins = new ArrayList<ATPlugin>();

    try {
      Iterator it = pluginManager.getRegistry().getPluginDescriptors().iterator();

      while (it.hasNext()) {
        PluginDescriptor pluginDescriptor = (PluginDescriptor) it.next();
        String id = pluginDescriptor.getId();
        ATPlugin plugin = (org.archiviststoolkit.plugin.ATPlugin) pluginManager.getPlugin(id);

        String cat = plugin.getCategory();
        String et = plugin.getEditorType();

        // check to make sure that the plugin is of the right category and
        // editor type and that it has a panel that can be embedded into
        // the resource editor panel
        if (cat.indexOf(category) != -1
            && et.indexOf(editorType) != -1
            && plugin.getEmbeddedPanels() != null) {
          foundPlugins.add(plugin);
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return foundPlugins;
  }
  /**
   * Method to return the ATPlugin for a particular and domain object
   *
   * @param domainObject The domain object to find a plugin for
   * @param category The category to find a domain object for
   * @return The plugin found or null if none can be located.
   */
  private ATPlugin getATPlugin(DomainObject domainObject, String category) {
    String editorType = getEditorTypeForDomainObject(domainObject);

    if (editorType != null) {
      ATPlugin foundPlugin = null;

      try {
        Iterator it = pluginManager.getRegistry().getPluginDescriptors().iterator();

        while (it.hasNext()) {
          PluginDescriptor pluginDescriptor = (PluginDescriptor) it.next();
          String id = pluginDescriptor.getId();
          ATPlugin plugin = (org.archiviststoolkit.plugin.ATPlugin) pluginManager.getPlugin(id);

          String cat = plugin.getCategory();
          String et = plugin.getEditorType();

          if (cat.indexOf(category) != -1 && et.indexOf(editorType) != -1) {
            foundPlugin = plugin;
            break;
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
      }

      return foundPlugin;
    } else {
      return null;
    }
  }