label.addListener( SWT.Paint, new Listener() { @Override public void handleEvent(final Event event) { if( isActive ) { label.setBackground( green ); } else { label.setBackground( red ); } } } );
This doesn't harmonise with the CSS Binding in E4, because we set the background before the CSS Databinding is running.
But I don't like this solution, is there any other way?
.MPartStack.active ExpandBar { background-color: #101010; color: black; } .MPartStack ExpandBar { background-color: #101010; color: black; } Label { font: Verdana 8px; color: white; } Composite Label { color: white; }
Why are you need creating a CSS-Rule for highlighted labels?
Current-Code: ------------- Label l = ... l.setForegroundColor(....) CSS/Java-Code: --------- Css: Label.highlight { color: red; } Java: IStylingEngine se = ... Label l = ... se.setClassname("highlighted");