From 260f7ea027af5bbc4e7503540bdc410ba87deef1 Mon Sep 17 00:00:00 2001 From: fedejeanne Date: Wed, 13 Sep 2023 07:27:35 +0200 Subject: [PATCH 1/2] Show progress indicator of "Run configurations..." after a delay Wait a while before showing the progress indicator in the dialog "Run configurations...". This avoids the flickering that happens when the task is completed in under 800 ms (which is the current norm in PlatformUI.getWorkbench().getProgressService().getLongOperationTime()) Contributes to eclipse-pde/eclipse.pde#679 --- .../LaunchConfigurationsDialog.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java index 9d30a075382..83291fc16ff 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java @@ -91,6 +91,7 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.progress.UIJob; import org.eclipse.ui.progress.WorkbenchJob; import org.osgi.framework.FrameworkUtil; @@ -1374,9 +1375,13 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable if (cancelable) { fProgressMonitorPart.attachToCancelComponent(null); } - fProgressMonitorPart.getParent().setVisible(true); + fActiveRunningOperations++; + // only show the progress bar if necessary after a delay + UIJob showProgressMonitorPart = createJobToShowProgressMonitorPart(); + showProgressMonitorPart.schedule(PlatformUI.getWorkbench().getProgressService().getLongOperationTime()); + //do work here collecting enabled states, otherwise to get these states we would need to //perform the validation of the dialog again, which is expensive and would cause flashing of widgets. Control[] children = ((Composite)fButtonComp.getChildren()[0]).getChildren(); @@ -1391,6 +1396,8 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable ModalContext.run(runnable, fork, fProgressMonitorPart, getShell().getDisplay()); } finally { + showProgressMonitorPart.cancel(); + fActiveRunningOperations--; updateRunnnableControls(true, prev); if (getShell() != null) { @@ -1409,6 +1416,17 @@ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable } } + private UIJob createJobToShowProgressMonitorPart() { + return UIJob.create("", __ -> { //$NON-NLS-1$ + // only show the progress monitor if there are still active operations by the + // time this job is executed + if (fActiveRunningOperations > 0) { + fProgressMonitorPart.getParent().setVisible(true); + } + return Status.OK_STATUS; + }); + } + /** * Updates the enablement of the runnable controls to appear disabled as a job is running * @param enabled the desired enable status of the dialog area, revert//apply buttons, and From c0b72e96015ddcb28aeb870d1373f216e6713766 Mon Sep 17 00:00:00 2001 From: fedejeanne Date: Wed, 13 Sep 2023 10:29:21 +0200 Subject: [PATCH 2/2] Bump version in Manifest * org.eclipse.debug.ui --> 3.18.200 --- debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF index 9611b62f435..35261b4ac26 100644 --- a/debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF +++ b/debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true -Bundle-Version: 3.18.100.qualifier +Bundle-Version: 3.18.200.qualifier Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin