|
26 | 26 | import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ASSOCIATION; |
27 | 27 | import static org.eclipse.ui.internal.registry.IWorkbenchRegistryConstants.ATT_THEME_ID; |
28 | 28 |
|
| 29 | +import java.io.IOException; |
29 | 30 | import java.util.ArrayList; |
30 | 31 | import java.util.HashMap; |
31 | 32 | import java.util.List; |
|
58 | 59 | import org.eclipse.jface.fieldassist.ControlDecoration; |
59 | 60 | import org.eclipse.jface.fieldassist.FieldDecorationRegistry; |
60 | 61 | import org.eclipse.jface.layout.GridDataFactory; |
| 62 | +import org.eclipse.jface.preference.IPersistentPreferenceStore; |
61 | 63 | import org.eclipse.jface.preference.IPreferenceStore; |
62 | 64 | import org.eclipse.jface.preference.PreferencePage; |
63 | 65 | import org.eclipse.jface.viewers.ArrayContentProvider; |
|
88 | 90 | import org.eclipse.ui.internal.WorkbenchPlugin; |
89 | 91 | import org.eclipse.ui.internal.themes.IThemeDescriptor; |
90 | 92 | import org.eclipse.ui.internal.util.PrefUtil; |
| 93 | +import org.eclipse.ui.preferences.ScopedPreferenceStore; |
91 | 94 | import org.eclipse.ui.themes.IThemeManager; |
92 | 95 | import org.osgi.service.prefs.BackingStoreException; |
93 | 96 |
|
@@ -238,8 +241,8 @@ private void createRescaleAtRuntimeCheckButton(Composite parent) { |
238 | 241 | } |
239 | 242 | createLabel(parent, ""); //$NON-NLS-1$ |
240 | 243 |
|
241 | | - boolean initialStateRescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH) |
242 | | - .getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, true); |
| 244 | + boolean initialStateRescaleAtRuntime = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, |
| 245 | + WorkbenchPlugin.PI_WORKBENCH).getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME); |
243 | 246 | rescaleAtRuntime = createCheckButton(parent, WorkbenchMessages.RescaleAtRuntimeEnabled, |
244 | 247 | initialStateRescaleAtRuntime); |
245 | 248 | if (!DPIUtil.isSetupCompatibleToMonitorSpecificScaling()) { |
@@ -486,16 +489,17 @@ public boolean performOk() { |
486 | 489 |
|
487 | 490 | boolean isRescaleAtRuntimeChanged = false; |
488 | 491 | if (rescaleAtRuntime != null) { |
489 | | - IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE |
490 | | - .getNode(WorkbenchPlugin.PI_WORKBENCH); |
| 492 | + IPersistentPreferenceStore configurationScopeNode = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, |
| 493 | + WorkbenchPlugin.PI_WORKBENCH); |
491 | 494 | boolean initialStateRescaleAtRuntime = configurationScopeNode |
492 | | - .getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, true); |
| 495 | + .getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME); |
493 | 496 | isRescaleAtRuntimeChanged = initialStateRescaleAtRuntime != rescaleAtRuntime.getSelection(); |
494 | | - configurationScopeNode.putBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, |
495 | | - rescaleAtRuntime.getSelection()); |
| 497 | + configurationScopeNode.setValue(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, |
| 498 | + Boolean.toString(rescaleAtRuntime.getSelection())); |
496 | 499 | try { |
497 | | - configurationScopeNode.flush(); |
498 | | - } catch (BackingStoreException e) { |
| 500 | + configurationScopeNode.save(); |
| 501 | + } catch (IOException e) { |
| 502 | + WorkbenchPlugin.log("Failed to set monitor-specific scaling preference", e); //$NON-NLS-1$ |
499 | 503 | } |
500 | 504 | } |
501 | 505 |
|
@@ -626,6 +630,12 @@ protected void performDefaults() { |
626 | 630 | IPreferenceStore apiStore = PrefUtil.getAPIPreferenceStore(); |
627 | 631 | useColoredLabels.setSelection(apiStore.getDefaultBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS)); |
628 | 632 |
|
| 633 | + if (rescaleAtRuntime != null) { |
| 634 | + IPreferenceStore configurationStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, |
| 635 | + WorkbenchPlugin.PI_WORKBENCH); |
| 636 | + rescaleAtRuntime.setSelection( |
| 637 | + configurationStore.getDefaultBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME)); |
| 638 | + } |
629 | 639 | enableMru.setSelection(defaultPrefs.getBoolean(StackRenderer.MRU_KEY_DEFAULT, StackRenderer.MRU_DEFAULT)); |
630 | 640 | super.performDefaults(); |
631 | 641 | } |
|
0 commit comments