From b9f5590e0871e172d89a8b2c21314d102f0949a0 Mon Sep 17 00:00:00 2001 From: Federico Jeanne Date: Fri, 19 Jun 2026 15:32:31 +0200 Subject: [PATCH 1/2] Only set dialog.setOpenOnRun(false) according to preference #486 Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/4086 --- .../ui/internal/progress/ProgressManager.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java index 233951109fd..c94d45296b5 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java @@ -955,8 +955,9 @@ private void busyCursorWhile(Runnable dialogWaitRunnable, ProgressMonitorJobsDia * Schedules the job that will open the progress monitor dialog. * * @param dialog the dialog to open + * @return the job that was scheduled to open the dialog */ - private void scheduleProgressMonitorJob(final ProgressMonitorJobsDialog dialog) { + private Job scheduleProgressMonitorJob(final ProgressMonitorJobsDialog dialog) { final WorkbenchJob updateJob = new WorkbenchJob(ProgressMessages.ProgressManager_openJobName) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { @@ -969,7 +970,7 @@ public IStatus runInUIThread(IProgressMonitor monitor) { }; updateJob.setSystem(true); updateJob.schedule(getLongOperationTime()); - + return updateJob; } /** @@ -1072,11 +1073,19 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable // Backward compatible code. final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog( ProgressManagerUtil.getDefaultParent()); - dialog.setOpenOnRun(false); - if (!shouldRunInBackground()) { - scheduleProgressMonitorJob(dialog); + if (shouldRunInBackground()) { + dialog.setOpenOnRun(false); + dialog.run(fork, cancelable, runnable); + } else { + Job showDialogJob = scheduleProgressMonitorJob(dialog); + try { + dialog.run(fork, cancelable, runnable); + } finally { + // In case the dialog hasn't popped up yet, cancel it so it doesn't pop up after + // the operation finishes or unwinds with an exception. + showDialogJob.cancel(); + } } - dialog.run(fork, cancelable, runnable); return; } From 4fb6dfacfc983bbb984dc55036ec93414b62d0cd Mon Sep 17 00:00:00 2001 From: Federico Jeanne Date: Mon, 22 Jun 2026 10:58:20 +0200 Subject: [PATCH 2/2] Cancel delayed progress dialog after busy cursor run Same as with the other call in the same class, whoever schedules the progress dialog to be shown after a delay (800 ms) should also make sure that the dialog doesn't pop-up if the runnable is finished before the delay has elapsed. --- .../ui/internal/progress/ProgressManager.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java index c94d45296b5..6aba4aedc63 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java @@ -942,13 +942,19 @@ public void busyCursorWhile(final IRunnableWithProgress runnable) */ private void busyCursorWhile(Runnable dialogWaitRunnable, ProgressMonitorJobsDialog dialog) { // Create the job that will open the dialog after a delay. - scheduleProgressMonitorJob(dialog); - final Display display = PlatformUI.getWorkbench().getDisplay(); - if (display == null) { - return; + Job showDialogJob = scheduleProgressMonitorJob(dialog); + try { + final Display display = PlatformUI.getWorkbench().getDisplay(); + if (display == null) { + return; + } + // Show a busy cursor until the dialog opens. + BusyIndicator.showWhile(display, dialogWaitRunnable); + } finally { + // In case the dialog hasn't popped up yet, cancel it so it doesn't pop up after + // the operation finishes or unwinds with an exception. + showDialogJob.cancel(); } - // Show a busy cursor until the dialog opens. - BusyIndicator.showWhile(display, dialogWaitRunnable); } /**