Progressbar patterns (Eclipse)
- by JesperE
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:
The code gets cluttered with lots of code which is not relevant to what the function actually does.
I need to manually guesstimate which parts of the code takes time, and which parts do not.
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?