Normally when a Job
is running, it is necessary to periodically update the user to let them know the state of the progress. By default, if a Job
provides no information, a generic busy indicator is shown. When a Job
is executed, it is passed an IProgressMonitor
, which can be used to notify the user of the progress (and provide a way to cancel the operation). A progress monitor has a number of tasks, each of which has a total unit of work that it can do. For jobs that don't have a known amount of work, UNKNOWN
can be specified and it will display in a generic busy indicator.
Open the
HelloHandler
and go to theexecute
method. In the innerrun
method, add abeginTask
at the beginning, and aworked
in the loop after each second's sleep, for five iterations. The code will look like:protected IStatus run(IProgressMonitor monitor) { try { monitor.beginTask("Preparing", 5000); for (int i = 0; i < 5; i++) { Thread.sleep(1000); monitor...