diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java index 523ea9f08ee..fd6afee8b6f 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java @@ -934,27 +934,34 @@ public void run() throws Exception { getShell().setData(this); trackShellActivation(); + /** - * When SWT zoom changes for primary monitor, prompt user to restart Eclipse to - * apply the changes. + * When rescaling at runtime is not activated, prompt for restart when an SWT + * zoom change for the primary monitor occurs. */ - getShell().addListener(SWT.ZoomChanged, event -> { - if (getShell().getDisplay().getPrimaryMonitor().equals(getShell().getMonitor())) { - int dialogResponse = MessageDialog.open(MessageDialog.QUESTION, getShell(), - WorkbenchMessages.Workbench_zoomChangedTitle, - WorkbenchMessages.Workbench_zoomChangedMessage, SWT.NONE, - WorkbenchMessages.Workbench_RestartButton, WorkbenchMessages.Workbench_DontRestartButton); - if (event.doit && dialogResponse == 0) { - getWorkbenchImpl().restart(true); - } - } - }); + if (!getShell().getDisplay().isRescalingAtRuntime()) { + addZoomChangeListenerToPromptForRestart(); + } } finally { HandlerServiceImpl.pop(); } } + private void addZoomChangeListenerToPromptForRestart() { + getShell().addListener(SWT.ZoomChanged, event -> { + if (getShell().getDisplay().getPrimaryMonitor().equals(getShell().getMonitor())) { + int dialogResponse = MessageDialog.open(MessageDialog.QUESTION, getShell(), + WorkbenchMessages.Workbench_zoomChangedTitle, WorkbenchMessages.Workbench_zoomChangedMessage, + SWT.NONE, WorkbenchMessages.Workbench_RestartButton, + WorkbenchMessages.Workbench_DontRestartButton); + if (event.doit && dialogResponse == 0) { + getWorkbenchImpl().restart(true); + } + } + }); + } + @PreDestroy void preDestroy() { if (mainMenu != null) {