コード例 #1
0
  /**
   * 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;
  }
コード例 #2
0
  /**
   * Maps the specified <code>MappingClass</code> to the specified tree node (<code>EObject</code>).
   *
   * @param theMappingClass the <code>Mapping</code> input
   * @param theTreeNode the <code>Mapping</code> output
   * @throws IllegalArgumentException if either input parameter is <code>null</code>
   */
  public void addMappingClassLocation(MappingClass theMappingClass, EObject theTreeNode) {
    // startTracking("addMappingClassLocation()"); //$NON-NLS-1$

    CoreArgCheck.isNotNull(theMappingClass);
    CoreArgCheck.isNotNull(theTreeNode);

    if (!mappingLocator.containsLocation(theMappingClass, theTreeNode)) {
      try {
        TreeMappingRoot treeMappingRoot =
            (TreeMappingRoot) mappingLocator.getMappingRoot(theMappingClass);
        mappingLocator.addOutputLocation(theMappingClass, theTreeNode);

        //                if( !isGeneratingMappingClasses() ) {
        addMappingClassAtLocation(treeMappingRoot, theMappingClass, theTreeNode);
        //                }

      } catch (Exception e) {
        PluginConstants.Util.log(IStatus.ERROR, e, e.getMessage());
      }
    }
    // stopTracking("addMappingClassLocation()"); //$NON-NLS-1$
  }