Skip to content

Commit b95f727

Browse files
committed
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.
1 parent 1552783 commit b95f727

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/progress/ProgressManager.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -942,13 +942,19 @@ public void busyCursorWhile(final IRunnableWithProgress runnable)
942942
*/
943943
private void busyCursorWhile(Runnable dialogWaitRunnable, ProgressMonitorJobsDialog dialog) {
944944
// Create the job that will open the dialog after a delay.
945-
scheduleProgressMonitorJob(dialog);
946-
final Display display = PlatformUI.getWorkbench().getDisplay();
947-
if (display == null) {
948-
return;
945+
Job showDialogJob = scheduleProgressMonitorJob(dialog);
946+
try {
947+
final Display display = PlatformUI.getWorkbench().getDisplay();
948+
if (display == null) {
949+
return;
950+
}
951+
// Show a busy cursor until the dialog opens.
952+
BusyIndicator.showWhile(display, dialogWaitRunnable);
953+
} finally {
954+
// In case the dialog hasn't popped up yet, cancel it so it doesn't pop up after
955+
// the operation finishes or unwinds with an exception.
956+
showDialogJob.cancel();
949957
}
950-
// Show a busy cursor until the dialog opens.
951-
BusyIndicator.showWhile(display, dialogWaitRunnable);
952958
}
953959

954960
/**

0 commit comments

Comments
 (0)