37
37
import org .eclipse .core .runtime .IExtensionPoint ;
38
38
import org .eclipse .core .runtime .IExtensionRegistry ;
39
39
import org .eclipse .core .runtime .Platform ;
40
+ import org .eclipse .core .runtime .Platform .OS ;
40
41
import org .eclipse .core .runtime .RegistryFactory ;
41
42
import org .eclipse .core .runtime .preferences .DefaultScope ;
42
43
import org .eclipse .core .runtime .preferences .IEclipsePreferences ;
53
54
import org .eclipse .jface .dialogs .MessageDialog ;
54
55
import org .eclipse .jface .fieldassist .ControlDecoration ;
55
56
import org .eclipse .jface .fieldassist .FieldDecorationRegistry ;
57
+ import org .eclipse .jface .layout .GridDataFactory ;
56
58
import org .eclipse .jface .preference .IPreferenceStore ;
57
59
import org .eclipse .jface .preference .PreferencePage ;
58
60
import org .eclipse .jface .util .Util ;
73
75
import org .eclipse .swt .widgets .Composite ;
74
76
import org .eclipse .swt .widgets .Control ;
75
77
import org .eclipse .swt .widgets .Display ;
78
+ import org .eclipse .swt .widgets .Group ;
76
79
import org .eclipse .swt .widgets .Label ;
77
80
import org .eclipse .ui .IWorkbench ;
78
81
import org .eclipse .ui .IWorkbenchPreferenceConstants ;
@@ -114,6 +117,7 @@ public class ViewsPreferencePage extends PreferencePage implements IWorkbenchPre
114
117
private boolean highContrastMode ;
115
118
116
119
private Button themingEnabled ;
120
+ private Button rescaleAtRuntime ;
117
121
118
122
private Button hideIconsForViewTabs ;
119
123
private Button showFullTextForViewTabs ;
@@ -135,6 +139,7 @@ protected Control createContents(Composite parent) {
135
139
layout .horizontalSpacing = 10 ;
136
140
comp .setLayout (layout );
137
141
createThemeIndependentComposits (comp );
142
+ createHiDPISettingsGroup (comp );
138
143
return comp ;
139
144
}
140
145
@@ -180,6 +185,8 @@ protected Control createContents(Composite parent) {
180
185
createHideIconsForViewTabs (comp );
181
186
createDependency (showFullTextForViewTabs , hideIconsForViewTabs );
182
187
188
+ createHiDPISettingsGroup (comp );
189
+
183
190
if (currentTheme != null ) {
184
191
String colorsAndFontsThemeId = getColorAndFontThemeIdByThemeId (currentTheme .getId ());
185
192
if (colorsAndFontsThemeId != null && !currentColorsAndFontsTheme .getId ().equals (colorsAndFontsThemeId )) {
@@ -192,6 +199,30 @@ protected Control createContents(Composite parent) {
192
199
return comp ;
193
200
}
194
201
202
+ private void createHiDPISettingsGroup (Composite parent ) {
203
+ if (!OS .isWindows ()) {
204
+ return ;
205
+ }
206
+ createLabel (parent , "" ); //$NON-NLS-1$
207
+ Group group = new Group (parent , SWT .LEFT );
208
+ group .setText (WorkbenchMessages .HiDpiSettingsGroupTitle );
209
+
210
+ GridData gridData = new GridData (SWT .FILL , SWT .CENTER , true , false );
211
+ gridData .horizontalSpan = ((GridLayout ) parent .getLayout ()).numColumns ;
212
+ group .setLayoutData (gridData );
213
+ group .setFont (parent .getFont ());
214
+ GridLayout layout = new GridLayout (1 , false );
215
+ group .setLayout (layout );
216
+ Label infoLabel = new Label (group , SWT .WRAP );
217
+ infoLabel .setText (WorkbenchMessages .RescaleAtRuntimeDisclaimer );
218
+ infoLabel .setLayoutData (GridDataFactory .defaultsFor (infoLabel ).create ());
219
+ createLabel (group , "" ); //$NON-NLS-1$
220
+
221
+ boolean initialStateRescaleAtRuntime = PrefUtil .getAPIPreferenceStore ()
222
+ .getBoolean (IWorkbenchPreferenceConstants .RESCALING_AT_RUNTIME );
223
+ rescaleAtRuntime = createCheckButton (group , WorkbenchMessages .RescaleAtRuntimeEnabled , initialStateRescaleAtRuntime );
224
+ }
225
+
195
226
private void createThemeIndependentComposits (Composite comp ) {
196
227
createUseRoundTabs (comp );
197
228
createColoredLabelsPref (comp );
@@ -227,7 +258,6 @@ private void createDependency(Button parent, Button dependent) {
227
258
GridData gridData = new GridData ();
228
259
gridData .horizontalIndent = 20 ;
229
260
dependent .setLayoutData (gridData );
230
-
231
261
boolean parentState = parent .getSelection ();
232
262
dependent .setEnabled (parentState );
233
263
@@ -341,6 +371,14 @@ public boolean performOk() {
341
371
.getSelection ();
342
372
prefs .putBoolean (PartRenderingEngine .ENABLED_THEME_KEY , themingEnabled .getSelection ());
343
373
374
+ boolean isRescaleAtRuntimeChanged = false ;
375
+ if (rescaleAtRuntime != null ) {
376
+ boolean initialStateRescaleAtRuntime = PrefUtil .getAPIPreferenceStore ()
377
+ .getBoolean (IWorkbenchPreferenceConstants .RESCALING_AT_RUNTIME );
378
+ isRescaleAtRuntimeChanged = initialStateRescaleAtRuntime != rescaleAtRuntime .getSelection ();
379
+ apiStore .setValue (IWorkbenchPreferenceConstants .RESCALING_AT_RUNTIME , rescaleAtRuntime .getSelection ());
380
+ }
381
+
344
382
prefs .putBoolean (CTabRendering .USE_ROUND_TABS , useRoundTabs .getSelection ());
345
383
try {
346
384
prefs .flush ();
@@ -367,19 +405,22 @@ public boolean performOk() {
367
405
colorFontsDecorator .hide ();
368
406
369
407
if (themeChanged || colorsAndFontsThemeChanged ) {
370
- showRestartDialog ();
408
+ showRestartDialog (WorkbenchMessages . ThemeChangeWarningTitle , WorkbenchMessages . ThemeChangeWarningText );
371
409
}
372
410
}
373
411
if (themingEnabledChanged ) {
374
- showRestartDialog ();
412
+ showRestartDialog (WorkbenchMessages .ThemeChangeWarningTitle , WorkbenchMessages .ThemeChangeWarningText );
413
+ }
414
+ if (isRescaleAtRuntimeChanged ) {
415
+ showRestartDialog (WorkbenchMessages .RescaleAtRuntimeSettingChangeWarningTitle ,
416
+ WorkbenchMessages .RescaleAtRuntimeSettingChangeWarningText );
375
417
}
376
418
377
419
return super .performOk ();
378
420
}
379
421
380
- private void showRestartDialog () {
381
- if (new MessageDialog (null , WorkbenchMessages .ThemeChangeWarningTitle , null ,
382
- WorkbenchMessages .ThemeChangeWarningText , MessageDialog .NONE , 2 ,
422
+ private void showRestartDialog (String title , String warningText ) {
423
+ if (new MessageDialog (null , title , null , warningText , MessageDialog .NONE , 2 ,
383
424
WorkbenchMessages .Workbench_RestartButton , WorkbenchMessages .Workbench_DontRestartButton )
384
425
.open () == Window .OK ) {
385
426
Display .getDefault ().asyncExec (() -> PlatformUI .getWorkbench ().restart ());
0 commit comments