protected XulDomContainer getXulContainer(String documentPath, IPentahoSession session) {
    try {
      ISolutionRepository repo = PentahoSystem.get(ISolutionRepository.class, session);
      InputStream in =
          repo.getResourceInputStream(documentPath, true, ISolutionRepository.ACTION_EXECUTE);
      SAXReader rdr = new SAXReader();
      final Document doc = rdr.read(in);

      XulDomContainer container = getXulLoader().loadXul(doc);

      return container;
    } catch (Exception e) {
      session.error(
          Messages.getErrorString("BaseMenuProvider.ERROR_0001_COULD_NOT_GET_MENU_CONTAINER"),
          e); //$NON-NLS-1$
    }
    return null;
  }
  protected XulMenubar getXulMenubar(String id, String documentPath, IPentahoSession session) {
    XulDomContainer container = getXulContainer(documentPath, session);
    if (container == null) {
      return null;
    }
    List<XulComponent> components =
        container.getDocumentRoot().getElementsByTagName("menubar"); // $NON-NLS-1$
    for (XulComponent component : components) {
      if (component instanceof XulMenubar && component.getId().equals(id)) {
        XulMenubar menubar = (XulMenubar) component;
        // now get customizations to it
        IPluginManager pluginManager = PentahoSystem.get(IPluginManager.class, session);
        List<?> menuCustomizations = pluginManager.getMenuCustomizations();
        for (Object custom : menuCustomizations) {
          if (custom instanceof IMenuCustomization) {
            IMenuCustomization item = (IMenuCustomization) custom;
            try {
              // apply each customization and log any failures
              MenuUtil.customizeMenu(menubar, item, getXulLoader());
            } catch (Exception e) {
              session.error(
                  Messages.getString(
                      "BaseMenuProvider.ERROR_0004_COULD_NOT_CUSTOMIZE_MENU",
                      item.getId(),
                      item.getLabel()),
                  e); //$NON-NLS-1$
            }
          }
        }

        return menubar;
      }
    }
    Logger.error(
        getClass().getName(),
        Messages.getErrorString(
            "BaseMenuProvider.ERROR_0002_COULD_NOT_GET_MENUBAR")); //$NON-NLS-1$
    return null;
  }