Cédric Brun bio photo

Cédric Brun

Build open-source technologies to enable mission critical tools for complex domains.

Email Twitter LinkedIn Github Youtube

I landed on a few articles about "UML in Colors" lately, I enjoyed reading those as modeling is used here as a design tool and support for efficient communication. It also made me think : that's a nice use case for our extensible modeling environment !

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




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 :


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:



I also used the tooltips on my tools to help the user identify the archetypes :





And here is the final result !


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 ? ;)