Apply (inheritable) style to attributed node but not its children

Hi, I have a language that contains only a few Attributes, a NodeAttribute is the one that matters. The editor for this NodeAttribute exposes the attributed node. The attributed node can have children, some of which can be annotated and some others without the annotation. This can happen at any depth

I want to make the text of the attributed nodes of a different color for those without the annotation. The problem is, once I set the text-foreground-color for in the attributed node editor cell, all the children of that attributed node get the color.

Note that, since the two languages are decoupled, I can't set any style attributes in the non-attributed nodes nor I could know, from the Attributes language, what is the default style of the attributed nodes.

In summary, I think I'm looking for a way of applying a style attribute to an attributed node but avoiding the inheritance to its children.

is this possible?

2 comments
Comment actions Permalink

The "unapply" style property set on the editor cells for the children of your attributed nodes could help you here, I think. This will effectively stop propagating the style down the editor cell tree, however, it requires some knowledge of the styles in the language of attributed nodes. 

0
Comment actions Permalink

I was wondering if there was any way, even if it means extending the editor language, of accomplishing this.

I created an "unapply-if" (just like apply-if works, but removing the style, like unapply) but the problem is that it only kicks in for the EditorCells that have StyleClass containing the unapply-if (the editor cells of my annotation), the condition of the unapply-if does not get evaluated for child nodes (just like apply).

In other words, it seems that only the style attributes get pushed down (text-foreground-color and such) but not the entire style.

Any ideas about how to accomplish this? Doesn't matter how crazy but the simpler the better :)

Thank you!

- Luis

0

Please sign in to leave a comment.