From 53391f3686d72f0f6d9a0c1a23fb1338a5095acd Mon Sep 17 00:00:00 2001
From: Phillipus
Date: Sun, 15 Sep 2024 11:39:14 +0100
Subject: [PATCH] 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.
---
.../eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
index 970658a7e4c..3d5ba0cb66f 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
@@ -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;
}
}
}
@@ -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);
}
}