Skip to content

Commit fa5f5a3

Browse files
Fix CLabel and Scale not respecting global themes in TimeGraphLegend
1 parent 770fa7c commit fa5f5a3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tmf/org.eclipse.tracecompass.tmf.ui/css/org.eclipse.tracecompass.tmf.ui.dark.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ IEclipsePreferences#org-eclipse-ui-workbench:org-eclipse-tracecompass-tmf-ui {
102102
'org.eclipse.tracecompass.tmf.ui.color.eventtable.highlight=0,128,0'
103103
}
104104

105+
.CLabelThemeTag, Scale {
106+
background-color:'#org-eclipse-ui-workbench-DARK_BACKGROUND';
107+
color:'#org-eclipse-ui-workbench-DARK_FOREGROUND';
108+
}
109+
105110
TimeGraphControl {
106111
background-color:#353636;
107112
color:#eeeeee

tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/dialogs/TimeGraphLegend.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ public void mouseEnter(MouseEvent e) {
391391
});
392392

393393
fBar.setLayoutData(GridDataFactory.swtDefaults().hint(30, 20).create());
394+
394395
CLabel label = new CLabel(this, SWT.NONE) {
395396
@Override
396397
protected String shortenText(GC gc, String t, int w) {
@@ -402,6 +403,9 @@ protected String shortenText(GC gc, String t, int w) {
402403
label.setData(LEGEND_ENTRY_KEY, name);
403404
label.setText(name);
404405
label.setLayoutData(GridDataFactory.fillDefaults().hint(160, SWT.DEFAULT).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
406+
//Without this the class created by overriding CLabel with @Override won't inherit theming
407+
label.setData("org.eclipse.e4.ui.css.CssClassName", "CLabelThemeTag"); //$NON-NLS-1$ //$NON-NLS-2$
408+
405409
fScale = new Scale(this, SWT.NONE);
406410
if (si.getStyleMap().get(StyleProperties.WIDTH) instanceof Integer) {
407411
fScale.setMinimum(1);

0 commit comments

Comments
 (0)