/**
   * Creates a {@link MappingRoot} having the specified <code>MappingClass</code> as it's input.
   *
   * @param theMappingClass the <code>MappingClass</code> used to create the mapping root
   * @return the index in the <code>mappingRoots</code> list of the new root
   * @throws IllegalArgumentException if input parameter is <code>null</code>
   */
  public EObject createTreeMappingRoot(MappingClass theMappingClass) {
    // startTracking("createTreeMappingRoot(GENERATING)"); //$NON-NLS-1$

    CoreArgCheck.isNotNull(theMappingClass);
    if (mappingLocator.hasTreeRoot(theMappingClass)) {
      return mappingLocator.getMappingRoot(theMappingClass);
    }

    TreeMappingRoot newRoot = null;
    try {
      // Defect 18433 - BML 8/31/05 - Changed call to create tree mapping root using a new
      // utility method that correctly adds it to the model (via addValue()) and also performs
      // additional work (i.e.adding nested Sql Helpers.
      newRoot =
          ModelResourceContainerFactory.createNewTreeMappingRoot(this.root, this.root.eResource());

      // Now add the mapping class to the Inputs list of the tree mapping root
      ModelerCore.getModelEditor().addValue(newRoot, theMappingClass, newRoot.getInputs());

    } catch (Exception theException) {
      Util.log(
          IStatus.ERROR,
          theException,
          Util.getString(
              PREFIX + "createMappingRootProblem", // $NON-NLS-1$
              new Object[] {root, theMappingClass}));
    }

    // stopTracking("createTreeMappingRoot(GENERATING)"); //$NON-NLS-1$
    return newRoot;
  }