Is EditorContext available in the generator in a property macro function?

Hi everyone!

Do you know whether EditorContext is available in the generator in a property macro? It seems like I cannot get it from operationContext. As a side note, what can the operationContext parameter be used for in a macro function?

Thank you,
Ana.
3 comments
Hi Ana,

I don't know of a way to get hold of an EditorContext in a property macro. Could you please describe the use-case that demands this?
The OperationContext parameter has been deprecated, as it has gradually become close to useless.

Vaclav
0
Vaclav, thank you for the quick reply!

My use case is the following: I have a set of languages and I want to transform one of these languages to  a latex document. The language that I am transforming contains bits of free text (for which I use the richtext plugin) and fragments from other languages embedded in it. I want to get the textual representation (as it appears on screen in MPS) of these language fragments and put them in a listing environment in latex. I looked at how you do copy and paste from the editor and I saw that you are using the renderText() function for each editor cell. I wanted to reuse that in a property macro. I realize that this might not be a clean solution.

I could also maybe generate text from the language fragments using the Textgen feature, but then I will have to modify the  TextGen artifacts everytime I modify the editor structure.

Do you maybe have other ideas on how to do this?

Regards,
Ana.
0
Hi Ana,

I'm afraid, this is not a scenario that MPS would support. Editors and Generators are relatively independent from one another. Reusable functionality should typically be put into Behavior, which can safely be accessed both in the editor and in the generator. We frequently override the BaseConcept.getPresentation() method to define the appearance of concepts in one place.

Vaclav
0

Please sign in to leave a comment.