Skip to content

Commit f1a031a

Browse files
committed
Use UserScope instead of ConfigurationScope for default theme
The default theme preference is now stored in user scope instead of configuration scope. UserScope is more appropriate as it represents a per-user setting that should roam with the user across installations, while ConfigurationScope is shared across all users of an installation.
1 parent 6e6bbbf commit f1a031a

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import org.eclipse.core.runtime.IProduct;
3939
import org.eclipse.core.runtime.Platform;
4040
import org.eclipse.core.runtime.RegistryFactory;
41-
import org.eclipse.core.runtime.preferences.ConfigurationScope;
4241
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
42+
import org.eclipse.core.runtime.preferences.UserScope;
4343
import org.eclipse.e4.core.contexts.ContextFunction;
4444
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
4545
import org.eclipse.e4.core.contexts.EclipseContextFactory;
@@ -317,9 +317,9 @@ private void setCSSContextVariables(IApplicationContext applicationContext, IEcl
317317
: getArgValue(E4Application.THEME_ID, applicationContext, false);
318318

319319
if (!themeId.isPresent() && !cssURI.isPresent()) {
320-
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
320+
IEclipsePreferences userScopeNode = UserScope.INSTANCE
321321
.getNode("org.eclipse.e4.ui.css.swt.theme");
322-
String defaultThemeId = configurationScopeNode.get("themeid", DEFAULT_THEME_ID);
322+
String defaultThemeId = userScopeNode.get("themeid", DEFAULT_THEME_ID);
323323
context.set(E4Application.THEME_ID, defaultThemeId);
324324
} else {
325325
context.set(E4Application.THEME_ID, themeId.orElseGet(() -> null));

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.eclipse.core.runtime.preferences.DefaultScope;
4343
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
4444
import org.eclipse.core.runtime.preferences.InstanceScope;
45+
import org.eclipse.core.runtime.preferences.UserScope;
4546
import org.eclipse.e4.core.contexts.IEclipseContext;
4647
import org.eclipse.e4.ui.css.swt.theme.ITheme;
4748
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
@@ -520,13 +521,13 @@ protected Control createCustomArea(Composite parent) {
520521
int result = dialog.open();
521522
if (result == 0 || result == 1) { // 0: Restart, 1: Don't Restart
522523
if (themeId != null && useAsDefault[0]) {
523-
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
524+
IEclipsePreferences userScopeNode = UserScope.INSTANCE
524525
.getNode(E4_THEME_EXTENSION_POINT);
525-
configurationScopeNode.put("themeid", themeId); //$NON-NLS-1$
526+
userScopeNode.put("themeid", themeId); //$NON-NLS-1$
526527
try {
527-
configurationScopeNode.flush();
528+
userScopeNode.flush();
528529
} catch (BackingStoreException e) {
529-
WorkbenchPlugin.log("Failed to set default theme in configuration scope", e); //$NON-NLS-1$
530+
WorkbenchPlugin.log("Failed to set default theme in user scope", e); //$NON-NLS-1$
530531
}
531532
}
532533
}

0 commit comments

Comments
 (0)