Related Theses:

  • Michael Matzen, A Generic Framework for Structure-Based Editing of Graphical Models in Eclipse, March 2010 (pdf)
  • Hauke Fuhrmann, On the Pragmatics of Graphical Modeling, Disputation: 2011-05-05 (pdf)

The KSBasE [Kay-space] project enables developers to add structure based features to an EMF-based editor. The term structure based refers to the fact that defined features are based on the editors EMF meta-model.

Java Projects

The following Java projects belong to this project:

Example Projects

Requirements

Install

KSBasE Extension Libraries

How it works

Creating structure based features using extensions

Currently KSBasE supports Xtend1 transformations as well as Java transformations (i.e. Xtend2).

It is recommend to create a new plug-in project for adding structure based editing features to your editor!
To add fancy new features to a diagram editor you can use the eclipse extension point mechanism:

Creating transformations

We are now creating some nice and simple features for the Thin Kieler SyncCharts Editor:

The first step for extending an editor is to create the model2model transformations. For the KSBasE features, those transformations are defined using Xtend.
To create the transformations, we are using a new package called de.cau.cs.kieler.synccharts.transformations and create a file called feature.ext.
Attention: You can use any package name, but the package must be included in the build path or else the Xtend code completion will not work.
Now we can start creating the transformation file. For now we will only create 2 transformations:

(If you'd like to see all transformations currently defined for the Synccharts Editor, you can have a look at the repository file)

The implementation of these transformations is easy:

import synccharts; //First import the synccharts metamodel

//Connects two states
Void connectStates(State source, State target):
let transition = new Transition:                 //Create new transition
transition.setSourceState(source) ->             //Set source
transition.setTargetState(target) ->             //and target state
setSelection(transition)                         //Select the transition.
;

//Adds a successor to the given state 
Void addSuccessorState(State source):
 let target = new State:                               //Create a new target state
 connectStates(source, target) ->                      //Call the connectStates extension
 source.parentRegion.innerStates.add(target) ->        //Add the new state
 setSelection(target)                                  //Select the new state
;

//Creates a default SyncChart
Void createDefault(Region rootRegion):
let state = new State:                            //Create a new root state
let innerState = new State:                       //Create a new inner state   
let region = new Region:                          //Create a new region for the root state
state.setLabel("SyncChart") ->                    //Set name of the state
state.regions.add(region) ->                      //Add region to the state
innerState.setLabel("Initial") ->                 //Set label of the inner state
innerState.setIsInitial(true) ->                  //The state type to initial           
region.innerStates.add(innerState) ->             //Add inner state
rootRegion.innerStates.add(state) ->              //Add root state
setSelection(innerState)                          //Select inner state
;

A few hints on creating Xtend in-place model-to-model transformations:

FAQ