Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show progress indicator of "Run configurations..." after delay #591

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
HannesWell marked this conversation as resolved.
Show resolved Hide resolved
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();
Expand All @@ -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) {
Expand All @@ -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
Expand Down