Dashboard > UDIG Developer Guide > Home > 5 FAQ > Eclipse RCP Questions > How should I use a Progress Monitor
How should I use a Progress Monitor Log In | Sign Up   View a printable version of the current page.

Added by Jesse Eichar , last edited by Administrator on Nov 16, 2007  (view change)
Labels: 
(None)

Q How should Progress Monitors be used?

A A few tips on using Progress Monitors:

  • Always start the progress monitor and do at least 1 bit of work. For example:
    monitor.beginTask("Working", 4);
    monitor.work(1);
  • Always finish started job.
    try{
      monitor.beginTask("Working", 4);
      monitor.work(1);
      // some work
    }finally{
      monitor.done();
    }
  • Make use of SubProgressMonitor if sending the monitor to another method:
    try{
      monitor.beginTask("Working", 8);
      monitor.work(1);
    
      SubProgressMonitor sub=new SubProgressMonitor(monitor, 3);
      doSomeWork(sub);
      sub.done();  // don't forget to make sure the sub monitor is done
    
      sub=new SubProgressMonitor(monitor, 3);
      doSomeMoreWork(sub);
      sub.done();  // don't forget to make sure the sub monitor is done (callee might not use it)
    
    }finally{
      monitor.done();
    }
Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS