Skip to content

Commit 4a2e251

Browse files
committed
Remove redundant flag check from ThemeEngine
If the boolean "flag" is set to false the last conditional check will never be true so return early. The theme will have been set anyway.
1 parent 5ba419c commit 4a2e251

File tree

1 file changed

+2
-4
lines changed
  • bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme

1 file changed

+2
-4
lines changed

bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,11 @@ public void restore(String alternateTheme) {
588588
prefThemeId = "org.eclipse.e4.ui.css.theme.e4_classic"; //$NON-NLS-1$
589589
}
590590

591-
boolean flag = true;
592591
if (prefThemeId != null) {
593592
for (ITheme t : getThemes()) {
594593
if (prefThemeId.equals(t.getId())) {
595594
setTheme(t, false);
596-
flag = false;
597-
break;
595+
return;
598596
}
599597
}
600598
}
@@ -608,7 +606,7 @@ public void restore(String alternateTheme) {
608606
boolean disableOSDarkThemeInherit = "true".equalsIgnoreCase(System.getProperty(DISABLE_OS_DARK_THEME_INHERIT));
609607
boolean overrideWithDarkTheme = Display.isSystemDarkTheme() && hasDarkTheme && !disableOSDarkThemeInherit;
610608
String themeToRestore = overrideWithDarkTheme ? E4_DARK_THEME_ID : alternateTheme;
611-
if (themeToRestore != null && flag) {
609+
if (themeToRestore != null) {
612610
setTheme(themeToRestore, false);
613611
}
614612
}

0 commit comments

Comments
 (0)