ProgressContext is the base class that you can extend to create a class that handles progress and log information. There are 5 different methods that you can override to receive calls when various events happen. The calls to these methods display on the background thread that the task is running on. The default implementation in
ProgressContext for these methods does nothing.
If you are creating a GUI in SWT the class SWTProgressContext is also available to extend from. It receives the method calls for the methods overridden on the SWT event dispatching thread. This is convenient because calls to update SWT widgets must be made from that thread.
progressUpdated(progress) is the method to override if you want to receive information when the current progress is updated.
progress is a value between 0 and 1.
progressDescriptionUpdated(description) is called when the description for what progress task that is currently running is changed.
progressLogUpdated(message) is called when a new line is added to the log of messages. This is mostly used for log information from the solvers.
started() is called when the progress task is about to start.
finished(t) is called when the progress task is finished. If an exception occurred while the progress task was running it is non-null. You can use the
isCanceled method to check if the progress task was canceled.
cancel() is the method to call if you want to request cancellation of the currently running progress task. You typically call it from a listener for a cancel button in your GUI.