The Amalgamation book is already describing how to define your own "Domain Neutral Component" model and create the
graphical modeler thanks to GMF. Let's take an existing formalism for a change and as I like Ecore, I'll pick Ecore.
Here is the diagram editor before the extension, quite boring isn't it ?
![](https://4.bp.blogspot.com/_u5tMWln_Ie8/S3A7bzr-3BI/AAAAAAAAAOA/uA41TAikiik/s400/ecorenotincolor.png)
We'll add an "archetypes" layer for the Ecore modeler, this layer only contains a specialization of the
container mapping definition used to display the EClasses in the Ecore modeler.
![](https://3.bp.blogspot.com/_u5tMWln_Ie8/S3A7N2Z1h4I/AAAAAAAAAN4/BRB5tzTYZoQ/s400/layerdefinition.png)
Specializing the diagram definition is mainly about adding a few new conditional styles (for the colors) and a few
tools in the palette. I decided to use Ecore's annotation to keep the information about "being an archetyped
EClass". Here is the full definition :
![](https://4.bp.blogspot.com/_u5tMWln_Ie8/S3A8qZl4sRI/AAAAAAAAAOY/t1SJdwPYnz8/s400/diagramdefinitionextension.png)
Let's have a closer look on a few user interactions : adding the original EClass mapping in "extra mappings" of the
tool definition allows me to define modeling assistant accelerators to contextually change an archetype:
![](https://2.bp.blogspot.com/_u5tMWln_Ie8/S3A8kbH6T_I/AAAAAAAAAOQ/Z4_ezW7N4fk/s400/colorswitchmodelingassistant.png)
![](https://1.bp.blogspot.com/_u5tMWln_Ie8/S3A8_eY1FXI/AAAAAAAAAOw/8z4JoiOYMUw/s400/archetypepalette.png)
I also used the tooltips on my tools to help the user identify the archetypes :
![](https://3.bp.blogspot.com/_u5tMWln_Ie8/S3A81MO8mkI/AAAAAAAAAOo/7dyB-LDOxGM/s400/tooltooltip.png)
And here is the final result !
![](https://4.bp.blogspot.com/_u5tMWln_Ie8/S3A8cTiUUeI/AAAAAAAAAOI/KIDJbk5FmJE/s400/ecoreincolor.png)
Of course not a single line of code is needed to get this and the modeler specification is automatically
deployed adapting the original Ecore one.
Enjoying the colors ? ;)