Adding merge support for models generated by model-to-model transformation mapping projects

If merge support is not specified for the type of metamodel that the transformation generates, or if you want to override the merge support that is specified for that type of metamodel, you can specify a merge extension in the mapping project or in the project that defines the target metamodel.

Before you begin

When you run the transformation that you created in using the authoring tools, the transformation creates a transient model, which is an instance of a specific Ecore metamodel. The Compare and Merge functionality provides implementations of a generic Ecore merge strategy, and a separate merge strategy for UML models. If the transformation generates a UML output model, you do not have to configure merge support. If the transformation generates an output model that is an instance of an Ecore metamodel, and if you want to merge transformation output, you should verify that merge support is configured for that type of Ecore metamodel. Typically, metamodel authors configure the merge support strategy of the metamodel and can specify custom merge strategies.

For example, consider a transformation that generates an output model called MyOutputModel.input; this model is an instance of the input.ecore metamodel. To determine if merge support is enabled for input.ecore metamodels, check the extensions in the plug-in that contains the definition of the input.ecore metamodel. If merge support is configured for the input.ecore metamodel, the plugin.xml file in the plug-in that defines the metamodel contains a merge extension similar to one in the code fragment at the bottom of this topic. To override the specified merge strategy, or if merge support is not configured for this type of metamodel, you can add a merge extension to your mapping project, or to the project that contains the metamodel definition.

About this task

To add a merge extension point to the plugin.xml file in the mapping project or in the project that contains the metamodel definition:

Procedure

  1. In the Project Explorer view, in the transformation mapping project, open the plugin.xml file.
  2. Click the Extensions tab.
  3. In the All extensions pane, click Add.
  4. Click the extension that represents the merge functionality to implement. For example, to specify the EMF merge extension point, click org.eclipse.core.contenttype.contentTypes.
  5. Click Finish.
  6. On the Extensions tab, in the All extensions pane, right-click the extension that you specify in step 4; then click New > file-association.
  7. In the file-extensions field, specify the model type that the mapping project defines. This field can contain a comma-separated list of file extensions to be associated with this content type.
  8. Click File > Save.

Example

The following example shows a code fragment from the plugin.xml file, after a merge extension point is added by completing the steps above. In this example, the plugin.xml file indicates that the EMF merge is available when you run a transformation, and the transformation generates a model that has .input as a file name extension. The file-extensions attribute represents the file type of the target model that is merging with another model.
<extension point="org.eclipse.core.runtime.contentTypes">
	<file-association content-type="com.ibm.xtools.comparemerge.emf.emfContentType" file-extensions="input"/>
</extension>

Feedback