A common usecase is running long processes and waiting for their completion. Therefore responsiveness is an important feature, that can be realized with the jobs-framework provided by eclipse. The user wants to continue working while a long running job is scheduled, not sitting in front of a frozen UI that is not responding until the job has finished.
Today I want to demonstrate some key features of the jobs api and encourage RCP developers to use the functionality to make a user friendly interaction and a clear management of your application-specific jobs. A good article for this topic you can find on the eclipse-website.
The Eclipse Jobs API can be divided into three parts:
Jobs Jobs are created in the plugins where the logic for processes are implemented. A job describes always a specific unit of work.
Job Manager The job manager handles the queuing, starting and locking of jobs dependent from the properties of a job. When you schedule a job the job-manager will check the conditions like a scheduling-rule or a lock to avoid conflicts with other resources.
User Interface The built-in user interface keeps the user on track and gives an overview of the scheduled jobs and their status.
No need for that. The frameworks takes the wiring of the tree components. If Job#schedule() is called the job is automatically queued into the Job Manager, the ProgressView will visualize the jobs that are queued.
With scheduling rules you can implement logic if a job can proceed or scheduled. Therefore you have to provide an implementation of ISchedulingRule where the job-manager can determine if a job can be started.
The example is a simple Eclipse RCP that demonstrates some features of the job-api. It works not directly on a job object, but on a wrapper, that makes life more easier and can also be used as a third-party-plugin for job-handling within your RCP. The following feature are covered:
UIJob/NonUIJobDialogScheduling RulesDelayJob ReturnValuesJob-ImagesDownload the Jobs Example as RCP (Source included - 10,5 Mbyte)Download the Jobs Example as Plugin (Source included - 30 kbyte) CVS-Checkout (more info)
转载自:
http://www.richclient2.de/2006_09_28/using-the-eclipse-jobs-api/#more-79参考: http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html
转载于:https://www.cnblogs.com/wuhenke/archive/2012/03/07/2384417.html