|Get Progress Monitor of a running Job? [message #1102113]
||Thu, 05 September 2013 11:31
| Alan DW
Registered: March 2012
I'm currently developing a plug-in which includes a Model-To-Model transformation, which takes some time on large models. Therefore, I've decided to create a window with progress bars for it, which looks like this:
... and because Eclipse provides a Jobs API, why not use it? So I created a job for it. However, I'm facing a couple of issues here, but to explain them, I need to say a few words about the job:
The main job consists of actually 3 jobs:
- Gathering the model elements to transform
- Transforming the elements
- Linking the transformed elements
These three parts should fill the upper progress bar. Each one of these forms a "sub-task" with a total work load equal to the number of elements to transform or link (unknown for the first one where elements are gathered). Each sub-task should fill the lower progress bar exactly once from 0 to 100%.
Okay, so I have this dialog set up, and I have a job at hand ready to do it. Now there are two problems with this:
1) In my window controller, I have access to the Job which is carrying out the task. However, I do NOT have access to the progress monitor it uses in its
method. It seems to be generated by Eclipse itself. But I have dire need of that very monitor in order to update my progress bars in my window. How do I get it, given the Job?
protected IStatus run(final IProgressMonitor monitor)
2) Moreover, I need to register some kind of listener to that monitor that gets notified each time the "worked()" method is called on the monitor. However, the IProgressMonitor interface does not provide any listener registration method...
2) The output of the "gather elements" job serves as the input for the "transform" job, which, in turn, produces output that is the input for the "link" job. In other words, each of the jobs depends on the output of the previous one. What's the most elegant, standard way to handle this kind of dependency? After all, Jobs don't have a return value as such that would expose any kind of content (it just exposes status information).
I hope that my questions are clear, if not, please let me know and I'll try to explain it in some more detail.
Thanks in advance,
Powered by FUDForum
. Page generated in 0.02172 seconds