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?
7 comments
Sort by
Date
Votes
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
One other way would be to use the `GeneratorFacade` from `com.mbeddr.mpsutil.generatorfacade` .
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.
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();
}
Yes, Slack user:U6K7KNMHB>, thanks a bunch, this works nicely!
There is also the `GeneratorUtil` in `com.mbeddr.mpsutil.generatorFacade` which has methods to run a generator or a generator plan.
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
Post is closed for comments.