Skip to content

Commit

Permalink
Remove redundant flag check from ThemeEngine
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Phillipus committed Sep 21, 2024
1 parent 5134445 commit d27b0c5
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,11 @@ public void restore(String alternateTheme) {
prefThemeId = "org.eclipse.e4.ui.css.theme.e4_classic"; //$NON-NLS-1$
}

boolean flag = true;
if (prefThemeId != null) {
for (ITheme t : getThemes()) {
if (prefThemeId.equals(t.getId())) {
setTheme(t, false);
flag = false;
break;
return;
}
}
}
Expand All @@ -608,7 +606,7 @@ public void restore(String alternateTheme) {
boolean disableOSDarkThemeInherit = "true".equalsIgnoreCase(System.getProperty(DISABLE_OS_DARK_THEME_INHERIT));
boolean overrideWithDarkTheme = Display.isSystemDarkTheme() && hasDarkTheme && !disableOSDarkThemeInherit;
String themeToRestore = overrideWithDarkTheme ? E4_DARK_THEME_ID : alternateTheme;
if (themeToRestore != null && flag) {
if (themeToRestore != null) {
setTheme(themeToRestore, false);
}
}
Expand Down

0 comments on commit d27b0c5

Please sign in to comment.