The org.eclipse.jface.operations package defines interfaces for long-running operations that require progress indicators or allow user cancellation of the operation. These interfaces are used in the implementation of the workbench progress dialogs and views.
In general, plug-ins should use the workbench support provided in IProgressService for running long operations, so that all plug-ins will have a consistent presentation of progress. See Workbench Concurrency Support for a complete discussion of the available support for progress dialogs and views. The remainder of this discussion highlights the details of the JFace operations infrastructure which is used by the workbench.
The platform runtime defines a common interface, IProgressMonitor, which is used to report progress to the user while long running operations are in progress. The client can provide a monitor as a parameter in many platform API methods when it is important to show progress to the user.
JFace defines more specific interfaces for objects that implement the user interface for a progress monitor.
IRunnableWithProgress is the interface for a long-running operation. The run method for this interface has an IProgressMonitor parameter that is used to report progress and check for user cancelation.
IRunnableContext is the interface for the different places in the UI where progress can be reported. Classes that implement this interface may choose to use different techniques for showing progress and running the operation. For example, ProgressMonitorDialog implements this interface by showing a progress dialog. IWorkbenchWindow implements this interface by showing progress in the workbench window's status line. WizardDialog implements this interface to show long running operations inside the wizard status line.
Note: The workbench UI provides additional support for operations in WorkspaceModifyOperation. This class simplifies the implementation of long-running operations that modify the workspace. It maps between IRunnableWithProgress and IWorkspaceRunnable. See the javadoc for further detail.
The ModalContext class is provided to run an operation that is modal from the client code's perspective. It is used inside the different implementations of IRunnableContext. If your plug-in needs to wait on the completion of a long-running operation before continuing execution, ModalContext can be used to accomplish this while still keeping the user interface responsive.
When you run an operation in a modal context, you can choose to fork the operation in a different thread. If fork is false, the operation will be run in the calling thread. If fork is true, the operation will be run in a new thread, the calling thread will be blocked, and the UI event loop will be run until the operation terminates.
For more information on the UI event loop, see Threading issues for clients.