EMF Refactor is an Eclipse open source tool environment conveniently supporting a structured model quality assurance process. In particular, EMF Refactor supports metrics reporting, smell detection, and refactoring for models being based on the Eclipse Modeling Framework, a widely used open source technology in model-based software development.
The tool environment mainly consists of two kinds of modules: For calculating model metrics, detecting smells, and executing refactorings there is an application module each. Similarly there are three specification modules for generating metrics, smell, and refactoring plugins containing Java code that can be used by the corresponding application module.
The refactoring tool consists of
- a Refactoring Application Module for applying EMF model refactorings in a uniform and user-friendly way,
- a Structured Refactoring Suite of predefined EMF model refactorings supporting several EMF-based languages, and
- a Refactoring Generation Module for specifying EMF model refactorings using several model transformation approaches.
Refactoring Application Module
EMF Refactor uses the Eclipse Language Toolkit (LTK) for homogenous refactoring application consisting of three parts. After triggering a model element, refactoring-specific basic conditions are checked (initial check). Then, the user has to set all parameters and the EMF Refactor checks whether the user input does not violate further conditions (final check). In case of erroneous parameters a detailed error message is shown. If the final check has passed, EMF Refactor provides a preview of the changes that will be performed by the refactoring using EMF Compare. Last but not least, these changes can be committed and the refactoring can take place (model change). Here, EMF Refactor supports undo and redo functionality, of course.
Structured Refactoring Suite
EMF Refactor currently supports 22 refactorings for Ecore models and 30 refactorings for UML2EMF models. A list of implemented refactorings can be found in the refactorings section.
Refactoring Generation Module
Since EMF Refactor uses the LTK technology mentioned above, a concrete refactoring specification requires up to three parts (i.e., specifications for initial checks, final checks, and the proper model changes). EMF Refactor currently supports three concrete mechanisms for EMF model refactoring specification. They can be specified using
- OCL expressions (for pre-condition checking), or
- the EMF model transformation tool Henshin. Here, EMF Refactor uses Henshin's model transformation engine for executing the refactoring as well as Henshin's pattern matching algorithm to detect violated preconditions.
Actually, we are working on a combination mechanism of existing refactorings to more complex ones by using a dedicated domain-specific language called CoMReL (Composite Model Refactoring Language) that will be integrated soon into the official release of EMF Refactor.