My previous message might have been unclear, so I hope this one clarifies more. I have developed a language in MPS, which has input fields and a result field. In the result, I would like to populate t...

This is an auto-generated question from the MPS Slack community: My previous message might have been unclear, so I hope this one clarifies more. I have developed a language in MPS, which has input fields and a result field. In the result, I would like to populate the result of running the generated java code from my language's java code generation. The image below should simplify what I am trying to do, is there any reference or example that can help me with this?
0
9 comments
Hi Natalie, [Edit] If you stream the results of your run to some file, that is related to the node, then you can add a 'R/O model access' field to your editor's 'Result'-section. In its implementation you have the node, which means you can work out the path to the result of your generated java code. Simply read the file (normal java stubs) and do some formatting to return the result as a string. To update the result you simply press F5 in the model.
0
Hi Natalie, if you generate Java code you can load it via reflection from the class loader of the solution that it is contained in. I have created a sample and wrote a short post about it:
0
Thank you very much! Slack user:U6K3FGW3U> and Slack user:U025QJQK0KG> I am reading the solution now.
0
I have successfully implemented your solution, thank you very much Slack user:U6K3FGW3U>! My only problem right now, is that I return a string on multiple lines in the getResult method, I would really appreciate if you can help me with this as well, I found something called multiLineComment, is there something simple I can use so my string representation in the result editor is on multiple lines, and not cramped on one line.
0
Please see clarification here:
0
The easiest way is to use the multiline property cell from mbeddr
0
Thank you very much Slack user:U6K3FGW3U> Is there any documentation reference? Is this what you are referring to?
0
yes it's this one, I'm not aware of any documentation but it should be straightforward, instead of `{myProp}` use `{myProp} ` in the editor
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.