net.refractions.udig.ui
Interface PreShutdownTask


public interface PreShutdownTask

Encapsulates a task that needs to be run at shutdown but before the workbench has been shutdown. It can be submitted to the ShutdownTaskList. Methods are NOT called in the Display thread.

Since:
1.1.0
Author:
Jesse

Method Summary
 int getProgressMonitorSteps()
          Returns the number of steps preShutdown(IProgressMonitor, IWorkbench, boolean) will use.
 boolean handlePreShutdownException(java.lang.Throwable t, boolean forced)
          called if preShutdown(IProgressMonitor, IWorkbench, boolean) throws an exception.
 boolean preShutdown(IProgressMonitor monitor, IWorkbench workbench, boolean forced)
          Called before shutdown is complete.
 

Method Detail

preShutdown

boolean preShutdown(IProgressMonitor monitor,
                    IWorkbench workbench,
                    boolean forced)
                    throws java.lang.Exception
Called before shutdown is complete. if !forced then the shutdown can be canceled if false is returned.

Parameters:
monitor - monitor for showing progress of task. The beginTask method will set the task name but the number of steps is ignored.
workbench - workbench that is shutting down
forced - if the shutdown is forced. If it is forced then shutdown cannot be canceled
Returns:
true if shutdown is permitted or false if not. ignored if forced==true.
Throws:
java.lang.Exception - if an exception is thrown it will be passed to handlePreShutdownException(Throwable, boolean)

handlePreShutdownException

boolean handlePreShutdownException(java.lang.Throwable t,
                                   boolean forced)
called if preShutdown(IProgressMonitor, IWorkbench, boolean) throws an exception.

Parameters:
t - the exception.
forced - if the shutdown is forced. If it is forced then shutdown cannot be canceled
Returns:
true if shutdown is permitted or false if not. ignored if forced==true.

getProgressMonitorSteps

int getProgressMonitorSteps()
Returns the number of steps preShutdown(IProgressMonitor, IWorkbench, boolean) will use. This is called only once just before all shutdown tasks are run.

Returns:
the number of steps preShutdown(IProgressMonitor, IWorkbench, boolean) will use.