Call generator programmatically

I know that this theme has already come back once or twice, but I wonder if in the newer versions of MPS, there is a possibility to call the generator chain for a model programmatically (e.g. from an intention or from a testcase).

1 comment

If you need model to model transformation aspect only, j.m.generator.GenerationFacade.process() would help (check javadoc there). There might be obstacles with threading and model locks you need to take care of. 

In case you need model to text as well, it gets bit more complicated, as there's no simple facade to generate text from a model. You should check TextGeneratorEngine, which is tailored for asynchronous multi-thread generation, and either duplicate some of the code from the class, or file a request against textgen with your scenario so that I can refactor the class to support scenarios other than use of TextGenerationEngine from make. Obvious improvement would be a constructor with alternative executor so that you can run text generation from within the same thread as your main code to avoid complicated synchronizations. 


Please sign in to leave a comment.