Feature of Template Editor

Support questions relating to the actifsource Template Editor

Feature of Template Editor

Postby aDiet » Thu Dec 02, 2010 8:52 am

Hello,

I've two questions:
In our master degree project, we compare some MDA-Tools and we want to create an example for each tool.
In my model, I have an "Application"-class, which can have multiple "Components". These components could be a "Button", a "TextField", a "Label" or something else ("Components" is the superclass of these).
Is it possible to have access to the Button, Textfield etc. in my Template Editor. So that I could write:

//selector: Application.component
if (component==Button)
//do something for Button
if (component==TextField)
//do something for TextField
if (component==Label)
//do something for Label

The if-Statements should not be in my sourcecode.
At the moment I say that the "Application"-class can have Buttons, can have TextField, can have Labels. So I have lots of relations in my class diagram. And in my Template I wrote:
//selector Application.button
do something for Button
//selector Application.textField
do something for TextField
//selector Application.label
do something for Label

The second way is a little bit complicated. Every time, when I create a new subclass, I need to update my class diagram. So I must say the "Application"-class can have can have TextField, can have Labels and now also "Containers".

I write also my second question here: Is ActifSource based on Eclipse Modeling Project (EMF) or do you use Eclipse only to show the GUI of your program? I couldn't find some information about that.
Many Thanks

aDiet
aDiet
 
Posts: 1
Joined: Mon Nov 22, 2010 11:12 am

Re: Feature of Template Editor

Postby micha » Thu Dec 02, 2010 9:16 am

Hello aDiet,

When Component is the super-class of Button, TextField etc in the model, then you can use a filtering cast in the selector in the template.
So, you have a context with selector "Application.component" and then for each type you make a nested context which have the selectors

  • Component:Button
  • Component:TextField
  • etc

The important thing is the colon, it is used for casting. Like this, the sub-contexts are executed only for those Components which are of the actual sub-type. Hope this answers your first question.

We use part of the EMF (the Draw2d and GEF) for our editors but not EMF. However, we support import of ecore meta-models to actifsource and exporting actifsource to ecore. Further, there is project scheduled which allows to use the actifsource template editor for EMF models.

Greetings,
- Micha
micha
 
Posts: 21
Joined: Thu Aug 05, 2010 2:41 pm
Location: Switzerland


Return to Template Editor

Who is online

Users browsing this forum: No registered users and 1 guest

cron