Eclipse RCP: Parallel jobs presented in one progress dialog?
Asked Answered
N

2

8

I would like to show progress of multiple Jobs running in parallel, but in only one progress dialog.

But each call to Job.setUser() seems to result in a new progress dialog.

I've tried:

  • Setting a common progress group on all the jobs (obtained via IJobManager.createProgressGroup()).
  • Having one parent job call setUser() and join a job family to which all the parallel jobs belong. (This results in a message that progress is blocked on the parent job, by the background tasks.)

What pattern can I follow to result in all the parallel jobs appearing in one progress dialog?

Nert answered 19/1, 2011 at 23:35 Comment(8)
Have you tried using org.eclipse.ui.progress.UIJob ?Zorina
@Favonius, thanks for the suggestion. I tried UIJob, but it runs jobs in the UI thread, which prevents them from running in parallel, and blocks the UI thread.Nert
@Andy Thomas-Cramer: Checkout this link jdg2e.com/ch29.jobs/doc/index.html. The tutorial executes two jobs simultaneously. Let me know if this helps or not.Zorina
@Favonius, that provides a helpful, sample workbench for experimenting with Jobs, with source code available at jdg2e.com. However, I have not been able to get one dialog for multiple jobs. I can get one progress view for multiple jobs; maybe I can pop that up.Nert
@Andy Thomas-Cramer: The good thing about eclipse is that the source code is readily available :) . Just hack through the progress view source. Essentially the idea is same, what you need to translate is Progress View -> Composite to Your Dialog -> Composite. I am combining all the comments and putting it as ans. Hope this will help.Zorina
Actually there is no way to "contribute" a job to an open ProgressMonitorDialog directly. I guess this is the desired behavior, becaus they are called background jobs ;). The probably easiest way is (like already mentioned) to use your own mechanism that uses similar techniques like the ProgressView and opens the Dialog if the queue of scheduled user-jobs change from 0 to 1. if any other job is about to run it will be added automatically to the open dialog...Plenipotentiary
Have you considered implementing a sub monitor pattern as described here henrik-eclipse.blogspot.com/2009/05/… instead?Zealand
I did try using SubMonitor with the recommended pattern. Didn't help with my problem of parallel jobs.Nert
Z
3

Have you tried using org.eclipse.ui.progress.UIJob. Checkout this link http://www.jdg2e.com/ch29.jobs/doc/index.html. https://web.archive.org/web/20090406175007/http://www.jdg2e.com:80/ see the download link at the bottom of the page, though I am not sure how relevant the solution is after 6 years.

The tutorial executes two jobs simultaneously.

UIJobs

The good thing about eclipse is that the source code is readily available :) . Just hack through the progress view source. Essentially the idea is same, what you need to translate is Progress View -> Composite to Your Dialog -> Composite.

Hope this will help.

Zorina answered 20/1, 2011 at 19:29 Comment(2)
It is helpful, but I have still not found how to show one user dialog for multiple concurrent jobs.Nert
The tutorial link is brokenHooves
P
0

The ProgressMonitorFocusJobDialog can show the progress of only one job. If you need to show progress of multiple jobs, then Progress View is your answer. The dialog will go away if the user clicks the "Run in background" checkbox

Prescience answered 23/3, 2011 at 5:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.