Diagram Adapter

A diagram adapter is responsible for opening a model using the appropriate editor making the editor's model available to the transformation system. For an example, have a look at the de.hpi.sam.blockDiagram.diagramAdapterplug-in.

Every diagram adapter must extend the abstract de.hpi.sam.mote.DiagramAdapter class and implement the getDiagramResource(URI) operation. This operation is called by the transformation system to open the model with the given URI and return a resource that contains the model. You can also overwrite the load() and save() operations if necessary. These operations are called before and after a transformation is executed.

Ecore metamodel of the block diagram adapter

Ecore metamodel of the block diagram adapter

To create a new diagram adapter, create a new EMF project with a new ecore file. Load platform:/plugin/de.hpi.sam.mote/model.mote.ecore as an additional resource. Create a new EClass that extends DiagramAdapter. Create an EMF genmodel and generate the model code. Then, you can implement the missing operations.

Finally, you have to extend the de.hpi.sam.mote.diagramAdapterExtension extension point. There you have to provide the ID of the plugin containing the metamodel code which the diagram adapter can handle, the nsURI of the package that contains the diagram adapter, as well as the name of the factory method that creates the diagram adapter (this is a bit dirty, right now...).