Table support in MPS 2.0 coming along nicely
MPS 2.0 will feature direct support for tables in editors. I am currently playing around with the code in the MASTER branch in the public git, and I have created a simple example for tables: decision table support for Java.
Here is an example model:
You can now comfortably insert new rows or columns, delete them, and enter expressions. The way you implement it in the editor definition is by subclassing a TableModel class, just as you know it from Swing. A couple of table model base classes exist for the various kinds of tables and matrixes you might want. In the case of this example, I map the table cells onto a linear structure, as defined in the following code (ExprHolders simply wrap/hold an arbitrary expression):
Finally, for generation, I first map it to a new generic switch expression I have added to Java - the intermediate model looks as follows:
In the last step, this is then mapped to a bunch of if statements....
Of course there are still a couple of quirks (it's an arbitrary pull from the repository, not a release!), but table support is coming along nicely.
Also the new build/make system for languages is nice. It now figures out automatically which parts of languages have to be regenerated, reducing average generation times quite a bit.