Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Get Progress Monitor of a running Job?
Get Progress Monitor of a running Job? [message #1102113] Thu, 05 September 2013 11:31 Go to next message
Alan DW is currently offline Alan DW
Messages: 105
Registered: March 2012
Senior Member
Hello everyone,

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:

http://imageshack.us/a/img571/4232/lm6w.png


... 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
protected IStatus run(final IProgressMonitor monitor)
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?


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,



Alan
Re: Get Progress Monitor of a running Job? [message #1103171 is a reply to message #1102113] Fri, 06 September 2013 12:56 Go to previous message
Alan DW is currently offline Alan DW
Messages: 105
Registered: March 2012
Senior Member
Hi,

I've managed to solve this problem using IRunnableWithProgress along with a custom subclass of SubProgressMonitor that allows to attach listeners. Unfortunately, this is not compliant with the Jobs API, but it works.

Greets,


Alan
Previous Topic:discouraged access to classes from plugin.xml
Next Topic:Adding a scecond page for Plugin Development Wizard in Eclipse
Goto Forum:
  


Current Time: Sun Oct 26 01:05:32 GMT 2014

Powered by FUDForum. Page generated in 0.01642 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software