Scheduling job

From Bioclipse
Jump to: navigation, search

Jobs represent operation which run for a long time and are not time critical.

Bioclipse provides defauilt Jobs for:

Creating a Job

  • Make a new class that will represent your work and extend the class.
  • Implement the protected IStatus run(IProgressMonitor monitor) method and put all your work in there.
  • See IStatus and IProgressMonitor for details how to influence the Jobs control flow. Useful methods are:
 IProgressMonitor.beginTask( "name" )
 IProgressMonitor.worked( amount );
  • Make sure the done method is called for every beginTask, so make a construction like
 try { 
     // ..
 } finally {
  • Make the return Status.OK_STATUS, or something more suitable for the situation.

Running a Job

 Job job = new MyJob();
 job.setUser(true); // Will pop up a dialog, otherwise it is run in the background