Different representations for one enum element
Hello Forum,
I am currently experimenting with different editors for the same model. In this context, I would need to have different representations for the same enumeration.
I will use a comparison type enumeration (with values: <,<=,==, >, >=) as an example.
Is it possible to provide two editors for the same model?
- First representation: i < j
- Second representation: i LESS j
So what I want to do is to have two different representations for the same operator. Depending on the preference of the developer, he should be able to choose one representation when defining his model.
Thanks,
Christian
Please sign in to leave a comment.
There is at least a couple of ways to implement that:
1) (if ...) cells in the editor. In other words, you make editor render one cell or another depending on some logic. The logic might check the current phase of the moon or whatever you like most.
2) There are "editor hints" that enable you to have multiple views of the same model and flip between them: https://confluence.jetbrains.com/display/MPSD34/Editor+cookbook#Editorcookbook-Hints
Hi Vladimir,
thanks for the answer. I already experimented with these options:
- Option 1 works fine in having a different read-only view, but based on this approach you cannot change the value of the enumeration. At least that was the problem with my implementation.
- Option 2: I do not see how I could change the representation of the enumeration value using this approach (as the representation is already defined in the structure and not in the editor aspect).
Any ideas?
Christian