Is it possible to run a generator programmatically on a model that I have created in a testcase?...

This is an auto-generated question from the MPS Slack community: Is it possible to run a generator programmatically on a model that I have created in a testcase?
0
7 comments
You could be able to use the calls in the preview text action, also I guess there are some tests in the MPS sources regarding the generator… did you check the sources out already? I strongly recommend to check the sources of MPS for more clarity
0
One other way would be to use the `GeneratorFacade` from `com.mbeddr.mpsutil.generatorfacade` .
0
Slack user:U6K7KNMHB> I did search the sources, and found the `Default_KeymapChanges.java` in which one finds that ctrl+shift+alt+f9 is mapped onto `jetbrains.mps.ide.make.actions.TextPreviewModel_Action`. However, looking into the action 'TextPreviewModel' from within MPS, it isn't immediately apparent how to run its 'execute'. Slack user:UA14L80HK> didn't know of that one. Will look into it. thanks.
0
Slack user:U025QJQK0KG> sorry, the preview is showing much more detail. the ‘MakeSelectedModels’ action might be better suited execute(event)->void { new MakeActionImpl(new MakeActionParameters(this.mpsProject).models(this.getModels())).executeAction(); }
0
Yes, Slack user:U6K7KNMHB>, thanks a bunch, this works nicely!
0
There is also the `GeneratorUtil` in `com.mbeddr.mpsutil.generatorFacade` which has methods to run a generator or a generator plan.
0
This is auto-generated question from the MPS Community Slack Workspace. If you want to comment on the question, do it from the Slack workspace
0

Post is closed for comments.