Progressbar patterns (Eclipse)

Posted by JesperE on Programmers See other posts from Programmers or by JesperE
Published on 2012-11-20T15:01:30Z Indexed on 2012/11/20 17:19 UTC
Read the original article Hit count: 209

I've struggled quite a bit with Eclipse and progress-monitors to try to have good progressbars which report useful progress information to the user. Inevitably the code gets cluttered with lots of things like

if (monitor.isCancelled())
    return;

...

lengthyMethodCall(monitor.newChild(10));

and all over the place I need to pass a IProgressMonitor as an argument to my methods. This is bad, for several reasons:

  1. The code gets cluttered with lots of code which is not relevant to what the function actually does.
  2. I need to manually guesstimate which parts of the code takes time, and which parts do not.
  3. It interacts badly with automated tests; where much of the information which goes into a progressbar instead should be logged for later inspection.

Is there a way out of this? Are there tools which can help me out with one or more of these problems? Should I be looking at Aspect-Oriented Programming tools, or are there other alternatives?

© Programmers or respective owner

Related posts about design-patterns

Related posts about eclipse