Skip to content

Commit e30a52d

Browse files
committed
Only prompt for restart on zoom change when not rescaling at runtime
When the zoom of the primary monitor changes, the workbench asks for a restart to adapt the workbench windows to the changed zoom. With the runtime rescaling functionality recently introduced to SWT, this behavior is only desired if that rescaling functionality is not activated. This change adapts the functionality for showing the restart prompt to only come up if the rescaling functionality is deactivated.
1 parent 6fc79c1 commit e30a52d

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -934,27 +934,33 @@ public void run() throws Exception {
934934

935935
getShell().setData(this);
936936
trackShellActivation();
937-
/**
938-
* When SWT zoom changes for primary monitor, prompt user to restart Eclipse to
939-
* apply the changes.
940-
*/
941-
getShell().addListener(SWT.ZoomChanged, event -> {
942-
if (getShell().getDisplay().getPrimaryMonitor().equals(getShell().getMonitor())) {
943-
int dialogResponse = MessageDialog.open(MessageDialog.QUESTION, getShell(),
944-
WorkbenchMessages.Workbench_zoomChangedTitle,
945-
WorkbenchMessages.Workbench_zoomChangedMessage, SWT.NONE,
946-
WorkbenchMessages.Workbench_RestartButton, WorkbenchMessages.Workbench_DontRestartButton);
947-
if (event.doit && dialogResponse == 0) {
948-
getWorkbenchImpl().restart(true);
949-
}
950-
}
951-
});
952-
937+
addZoomChangeListenerToPromptForRestart();
953938
} finally {
954939
HandlerServiceImpl.pop();
955940
}
956941
}
957942

943+
private void addZoomChangeListenerToPromptForRestart() {
944+
getShell().addListener(SWT.ZoomChanged, event -> {
945+
/**
946+
* Prompt for restart when an SWT zoom change for the primary monitor occurs,
947+
* only when rescaling at runtime is not activated.
948+
*/
949+
if (getShell().getDisplay().isRescalingAtRuntime()) {
950+
return;
951+
}
952+
if (getShell().getDisplay().getPrimaryMonitor().equals(getShell().getMonitor())) {
953+
int dialogResponse = MessageDialog.open(MessageDialog.QUESTION, getShell(),
954+
WorkbenchMessages.Workbench_zoomChangedTitle, WorkbenchMessages.Workbench_zoomChangedMessage,
955+
SWT.NONE, WorkbenchMessages.Workbench_RestartButton,
956+
WorkbenchMessages.Workbench_DontRestartButton);
957+
if (event.doit && dialogResponse == 0) {
958+
getWorkbenchImpl().restart(true);
959+
}
960+
}
961+
});
962+
}
963+
958964
@PreDestroy
959965
void preDestroy() {
960966
if (mainMenu != null) {

0 commit comments

Comments
 (0)