
Contents |
As contributed in [1], a core of refactorings can be re-used in different metamodels. This core consists of the participating elements and the transformation steps. Hence definition of the participants will be described here.
This approach is inspired by the role paradigm from Riehle and Gross from [2] in which roles are used to define collaborations between objects in different contexts.
Based on that work we introduced roles in model refactoring, too, saying that different metaclasses play another dedicated role in different model refactorings. For this purpose a new DSL was designed which is used to define role models for refactorings. In the bottom part the links to the SVN repository can be found. In the following a small example is given on how role models can be defined.
To create a new role model you have to invoke File -> New -> Other... and start the wizard EMFText .rolestext file under the category Refactory. Then an editor will open and you can define the roles being participated in your desired generic model refactoring. The following figure shows a role model with three roles intended to be used if an element has to be moved from one container to another container like, e.g., when an property of a UML classhas to be pulled up in the inheritance hierarchy.
Besides the textual syntax we defined a graphical syntax, as well. Start using a graphical editor by invoking File -> New -> Other... and start the wizard Role Model diagram under the category Refactory. Then you'll get an editor like the following figure shows.
The model created with the graphical editor will be persisted with the previously shown textual syntax. That means that both textual and graphical role models are kept consistent and changes will be propagated from one representation to the other.
org.emftext.language.refactoring.roles
org.emftext.language.refactoring.roles.resource.rolestext
org.emftext.language.refactoring.roles.resource.rolestext.ui
org.emftext.language.refactoring.roles.postprocessing
org.emftext.language.refactoring.roles.builder
org.emftext.language.refactoring.roles.edit
org.emftext.language.refactoring.roles.diagram