|
|
# General Principle
|
|
|
Extracting the model from the code and storing the changed model to the code is triggered via the UI.
|
|
|
The extraction is triggered by the class ModelExtractionHandler. After the extraction, the ModelExtractionHandler creates a ResourceChangeListener, which starts to store the changed model to the code when the model resource changes.
|
|
|
|
|
|
The UI classes collect all high level information (e.g. projects to extract from and languages to translate). The actual translation is executed by the class TransformationManager and the classes that are called by the TransformationManager.
|
|
|
|
|
|
The following diagrams show the participants and their interaction for executing the translation. While this translation is executed, IDs are generated for all elements and traced from code elements to model elements through the transformations. This is not subject of the following diagrams and is described in [ID Management](ID_Management.md).
|
|
|
|
|
|
# Extract Model from Code
|
|
|
First the ModelExtractionHandler collects the projects to translate, and the involved languages, based on the selected project in the Eclipse UI and the language registry. This information is given to the TransformationManager for executing the translation.
|
|
|
When the complete translation finished, the ModelExtractionHandler opens the editor for the ADL, and creates a ResourceChangeListener, which will finally trigger to store the model to the code again.
|
|
|
|
|
|
![UI_-_Extract_Model_From_Code](/uploads/fa5f5e2e26da7fa97f3bb742afd03f01/UI_-_Extract_Model_From_Code.png)
|
|
|
|
|
|
The TransformationManager first gets the root code-to-model transformation class from the LanguageDefinition class of the Architecture Implementation Language. This transformation is instantiated and the model is extracted using toModel(). The transformation classes search for predefined structures in the source code and creates model elements accordingly. Despite the diagram below, the transformation classes **are not destroyed**.
|
|
|
|
|
|
The transformation manager then creates task objects for TGG and model transformations. The first TGG transformation creates an IL model from the Implementation model. The model transformations are used for inter-module transformations. At last a TGG transformation is used to create an ADL model. The ADL model is stored to a temporary resource, because the most model editors in Eclipse require a resource to work with.
|
|
|
|
|
|
![TransformationManager_-_Extract_Model_From_Code](/uploads/4022b87f105fb27c512cd5fa32f19504/TransformationManager_-_Extract_Model_From_Code.png)
|
|
|
|
|
|
# Write Changed Model to Code
|
|
|
|
|
|
![UI_-_Translate_Changed_Model_to_Code](/uploads/fda8a8437239860c33fb22dc2cfc68aa/UI_-_Translate_Changed_Model_to_Code.png)
|
|
|
|
|
|
![TransformationManager_-_Translate_Changed_Model_To_Code](/uploads/6880839dc5ece70fe59cfb407925c6c8/TransformationManager_-_Translate_Changed_Model_To_Code.png) |