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.
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.
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.