OK, the screen-shot link was broken, so I ignored it. My mistake.
Now, seeing the code I suspect you may need to provide the colors. ATM you are returning an instance of Expression, which is an abstract concepts (cannot be instantiated, thus the error). Import the java.awt.* model (Control + M) and type Color.xxx
Now I can select a color... but my code still does not work. Seems like something is wrong with the if-condition node.name == "Hardware". But returning a color without condition works fine.
Sorry, i'm very new to MPS and language workbenches... very hard at the beginning :-\
It's good to see you progressing. You need to use the equals() method to compare strings reliably. Or better use the MPS' :eq: operator, which is a null-safe variant of equals.
Hello Mirko,
You can set query style value. And write something like this:
underlined : (node, editorContext)->boolean {
<condition>
}
text-foreground-color : (node, editorContext)->Color {
if (<condition>) {
return Color.BLUE;
} else {
return Color.BLACK;
}
}
Regards,
Evgeny
Hi Evgeny,
where do i have to put this query-style value? Actually i'm editing within the Editor-Inspector of a Property-Cell:
Within the "Style"-section i can't define such conditions... I guess that place is wrong :-\
Thank you,
Mirko
Attachment(s):
mps_style.PNG
Hello Mirko,
Try to press Ctrl + Space on the value of style. In completion menu should be value query.
Regards, Evgeny
Attachment(s):
Picture.png
Hi Evgeny,
thank you very much!
it works perfect.
Regards,
Mirko
the way described above doesn't work for me...
/_persistent/style.PNG?file=29-3894&v=0&c=true
I get an error, which i don't understand:
"Abstract concept instance detected: Use on of sub-concepts instead. Concept: Expression"
Any ideas? :-)
It's a very simple example.. just a concept called "stereotype" implementing INamedConcept and the editor only contains {name}.
My purpose is to change the text color, if the concept ist named "Hardware"
Now, seeing the code I suspect you may need to provide the colors. ATM you are returning an instance of Expression, which is an abstract concepts (cannot be instantiated, thus the error).
Import the java.awt.* model (Control + M) and type Color.xxx
Now I can select a color... but my code still does not work. Seems like something is wrong with the if-condition node.name == "Hardware". But returning a color without condition works fine.
Sorry, i'm very new to MPS and language workbenches... very hard at the beginning :-\