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?

Andy Thomas
  • 84,978
  • 11
  • 107
  • 151
  • Have you tried using `org.eclipse.ui.progress.UIJob` ? – Favonius Jan 20 '11 at 06:30
  • @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. – Andy Thomas Jan 20 '11 at 14:56
  • @Andy Thomas-Cramer: Checkout this link http://www.jdg2e.com/ch29.jobs/doc/index.html. The tutorial executes two jobs simultaneously. Let me know if this helps or not. – Favonius Jan 20 '11 at 15:39
  • @Favonius, that provides a helpful, sample workbench for experimenting with Jobs, with source code available at http://www.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. – Andy Thomas Jan 20 '11 at 19:01
  • 1
    @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. – Favonius Jan 20 '11 at 19:24
  • 1
    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... – Tom Seidel Jan 21 '11 at 12:36
  • Have you considered implementing a sub monitor pattern as described here http://henrik-eclipse.blogspot.com/2009/05/progress-monitor-patterns.html instead? – djondal Feb 23 '11 at 18:18
  • I did try using SubMonitor with the recommended pattern. Didn't help with my problem of parallel jobs. – Andy Thomas Feb 23 '11 at 22:35

2 Answers2

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.

Favonius
  • 13,959
  • 3
  • 55
  • 95
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

Prakash G. R.
  • 4,746
  • 1
  • 24
  • 35