1
1
/*
2
- * Copyright (c) 2018, 2023 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2018, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
*
4
4
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
5
*
134
134
import org .openjdk .jmc .ui .UIPlugin ;
135
135
import org .openjdk .jmc .ui .accessibility .FocusTracker ;
136
136
import org .openjdk .jmc .ui .common .util .AdapterUtil ;
137
+ import org .openjdk .jmc .ui .common .util .ThemeUtils ;
137
138
import org .openjdk .jmc .ui .handlers .ActionToolkit ;
138
139
import org .openjdk .jmc .ui .handlers .CopySelectionAction ;
139
140
import org .openjdk .jmc .ui .handlers .InFocusHandlerActivator ;
@@ -212,8 +213,10 @@ public void run() {
212
213
private static final Color ALTERNATE_COLOR = SWTColorToolkit .getColor (new RGB (255 , 255 , 240 ));
213
214
private static final String COUNT_IMG_KEY = "countColor" ; //$NON-NLS-1$
214
215
private static final Color COUNT_COLOR = SWTColorToolkit .getColor (new RGB (100 , 200 , 100 ));
216
+ private static final Color COUNT_COLOR_DARK_MODE = SWTColorToolkit .getColor (new RGB (7 , 94 , 7 ));
215
217
private static final String SIBLINGS_IMG_KEY = "siblingsColor" ; //$NON-NLS-1$
216
218
private static final Color SIBLINGS_COUNT_COLOR = SWTColorToolkit .getColor (new RGB (170 , 250 , 170 ));
219
+ private static final Color SIBLINGS_COUNT_COLOR_DARK_MODE = SWTColorToolkit .getColor (new RGB (8 , 115 , 8 ));
217
220
private static final int [] DEFAULT_COLUMN_WIDTHS = {650 , 80 , 120 };
218
221
private static final String THREAD_ROOT_KEY = "threadRootAtTop" ; //$NON-NLS-1$
219
222
private static final String FRAME_OPTIMIZATION_KEY = "distinguishFramesByOptimization" ; //$NON-NLS-1$
@@ -860,12 +863,13 @@ public void handleEvent(Event event) {
860
863
long forkOffset = parentFork .getItemOffset ();
861
864
int siblingsStart = (int ) Math .floor (event .width * forkOffset / total );
862
865
int siblingsWidth = (int ) Math .round (event .width * parentFork .getAggregateItemsInFork () / total );
863
- event .gc .setBackground (SIBLINGS_COUNT_COLOR );
866
+ event .gc .setBackground (
867
+ ThemeUtils .isDarkTheme () ? SIBLINGS_COUNT_COLOR_DARK_MODE : SIBLINGS_COUNT_COLOR );
864
868
event .gc .fillRectangle (event .x + siblingsStart , event .y , siblingsWidth , event .height );
865
869
// Draw group
866
870
double offset = (forkOffset + frame .getBranch ().getItemOffsetInFork ()) / total ;
867
871
double fraction = frame .getAttributeAggregate () / total ;
868
- event .gc .setBackground (COUNT_COLOR );
872
+ event .gc .setBackground (ThemeUtils . isDarkTheme () ? COUNT_COLOR_DARK_MODE : COUNT_COLOR );
869
873
int startPixel = (int ) Math .floor (event .width * offset );
870
874
int widthPixel = (int ) Math .round (event .width * fraction );
871
875
event .gc .fillRectangle (event .x + startPixel , event .y , Math .max (widthPixel , 1 ), event .height );
@@ -886,12 +890,13 @@ public void handleEvent(Event event) {
886
890
long forkOffset = parentFork .getItemOffset ();
887
891
int siblingsStart = (int ) Math .floor (event .width * forkOffset / total );
888
892
int siblingsWidth = (int ) Math .round (event .width * parentFork .getAggregateItemsInFork () / total );
889
- event .gc .setBackground (SIBLINGS_COUNT_COLOR );
893
+ event .gc .setBackground (
894
+ ThemeUtils .isDarkTheme () ? SIBLINGS_COUNT_COLOR_DARK_MODE : SIBLINGS_COUNT_COLOR );
890
895
event .gc .fillRectangle (event .x + siblingsStart , event .y , siblingsWidth , event .height );
891
896
// Draw group
892
897
double offset = (forkOffset + frame .getBranch ().getItemOffsetInFork ()) / total ;
893
898
double fraction = frame .getAttributeAggregate () / total ;
894
- event .gc .setBackground (COUNT_COLOR );
899
+ event .gc .setBackground (ThemeUtils . isDarkTheme () ? COUNT_COLOR_DARK_MODE : COUNT_COLOR );
895
900
int startPixel = (int ) Math .floor (event .width * offset );
896
901
int widthPixel = (int ) Math .round (event .width * fraction );
897
902
event .gc .fillRectangle (event .x + startPixel , event .y , Math .max (widthPixel , 1 ), event .height );
@@ -1057,7 +1062,7 @@ public Image getImage(Object element) {
1057
1062
1058
1063
@ Override
1059
1064
public Color getBackground (Object element ) {
1060
- if (treeLayout ) {
1065
+ if (treeLayout || ThemeUtils . isDarkTheme () ) {
1061
1066
return null ;
1062
1067
} else {
1063
1068
int parentCount = 0 ;
0 commit comments