Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import org.eclipse.core.runtime.IProduct;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.UserScope;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
Expand Down Expand Up @@ -317,9 +317,9 @@ private void setCSSContextVariables(IApplicationContext applicationContext, IEcl
: getArgValue(E4Application.THEME_ID, applicationContext, false);

if (!themeId.isPresent() && !cssURI.isPresent()) {
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
IEclipsePreferences userScopeNode = UserScope.INSTANCE
.getNode("org.eclipse.e4.ui.css.swt.theme");
String defaultThemeId = configurationScopeNode.get("themeid", DEFAULT_THEME_ID);
String defaultThemeId = userScopeNode.get("themeid", DEFAULT_THEME_ID);
context.set(E4Application.THEME_ID, defaultThemeId);
Comment on lines +320 to 323
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching the default theme preference from ConfigurationScope to UserScope will cause existing installations that already stored themeid in ConfigurationScope to silently fall back to DEFAULT_THEME_ID until the user re-saves the preference. Consider reading from UserScope first and falling back to ConfigurationScope when the key is absent (and optionally migrating/copying the value into UserScope) to preserve backwards compatibility.

Copilot uses AI. Check for mistakes.
} else {
context.set(E4Application.THEME_ID, themeId.orElseGet(() -> null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.core.runtime.preferences.UserScope;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.css.swt.theme.ITheme;
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
Expand Down Expand Up @@ -451,13 +452,13 @@ protected Control createCustomArea(Composite parent) {
int result = dialog.open();
if (result == 0 || result == 1) { // 0: Restart, 1: Don't Restart
if (themeId != null && useAsDefault[0]) {
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
IEclipsePreferences userScopeNode = UserScope.INSTANCE
.getNode(E4_THEME_EXTENSION_POINT);
configurationScopeNode.put("themeid", themeId); //$NON-NLS-1$
userScopeNode.put("themeid", themeId); //$NON-NLS-1$
try {
configurationScopeNode.flush();
userScopeNode.flush();
} catch (BackingStoreException e) {
WorkbenchPlugin.log("Failed to set default theme in configuration scope", e); //$NON-NLS-1$
WorkbenchPlugin.log("Failed to set default theme in user scope", e); //$NON-NLS-1$
}
}
}
Expand Down
Loading