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 @@ -81,6 +81,7 @@
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand Down Expand Up @@ -687,8 +688,8 @@ private static void setRescaleAtRuntimePropertyFromPreference() {
+ " is configured (e.g., via the INI), but the according preference should be preferred instead." //$NON-NLS-1$
));
} else {
boolean rescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
boolean rescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this possibly take a system property into account for the default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Question would be which one to take into account. What the preference currently does is to set a system property which configures the HiDPI behavior of SWT. If you specify that system property manually (via INI/VM argument), this will be used anyway (in the if-block above) and the preference will be ignored.
So if we want to take a preference into account, we should probably just remove the if/else and integrate the system property value into this preference evaluation. The reason for not doing it that way was that we wanted to log a warning, as the interaction between system property and preference may be hard to understand, so setting a VM argument or INI flag to define it should be avoided in favor of simply using the preference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I would keep as is for now (it conforms to the existing behavior also defaulting to "false"). Additionally, this is currently only an experimental preference (which is reasonably set to "false" by default) to be replaced by a "proper" one once the feature is ready to be used productively and potentially activated by default.

System.setProperty(SWT_RESCALE_AT_RUNTIME_PROPERTY, Boolean.toString(rescaleAtRuntime));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Platform.OS;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.core.runtime.preferences.ConfigurationScope;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
Expand Down Expand Up @@ -218,8 +219,8 @@ private void createHiDPISettingsGroup(Composite parent) {
infoLabel.setLayoutData(GridDataFactory.defaultsFor(infoLabel).create());
createLabel(group, ""); //$NON-NLS-1$

boolean initialStateRescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
boolean initialStateRescaleAtRuntime = ConfigurationScope.INSTANCE.getNode(WorkbenchPlugin.PI_WORKBENCH)
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
rescaleAtRuntime = createCheckButton(group, WorkbenchMessages.RescaleAtRuntimeEnabled, initialStateRescaleAtRuntime);
}

Expand Down Expand Up @@ -373,10 +374,17 @@ public boolean performOk() {

boolean isRescaleAtRuntimeChanged = false;
if (rescaleAtRuntime != null) {
boolean initialStateRescaleAtRuntime = PrefUtil.getAPIPreferenceStore()
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME);
IEclipsePreferences configurationScopeNode = ConfigurationScope.INSTANCE
.getNode(WorkbenchPlugin.PI_WORKBENCH);
boolean initialStateRescaleAtRuntime = configurationScopeNode
.getBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, false);
isRescaleAtRuntimeChanged = initialStateRescaleAtRuntime != rescaleAtRuntime.getSelection();
apiStore.setValue(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME, rescaleAtRuntime.getSelection());
configurationScopeNode.putBoolean(IWorkbenchPreferenceConstants.RESCALING_AT_RUNTIME,
rescaleAtRuntime.getSelection());
try {
configurationScopeNode.flush();
} catch (BackingStoreException e) {
}
}

prefs.putBoolean(CTabRendering.USE_ROUND_TABS, useRoundTabs.getSelection());
Expand Down
Loading