protected final IStatus run( IProgressMonitor ipm )
{
StudioProgressMonitor monitor = new StudioProgressMonitor( externalProgressMonitor == null ? ipm
: externalProgressMonitor );
// ensure that connections are opened
Connection[] connections = getConnections();
for ( int i = 0; i < connections.length; i++ )
{
if ( connections[i] != null && !connections[i].getJNDIConnectionWrapper().isConnected() )
{
monitor.setTaskName( Messages.bind( Messages.jobs__open_connections_task, new String[]
{ connections[i].getName() } ) );
monitor.worked( 1 );
connections[i].getJNDIConnectionWrapper().connect( monitor );
connections[i].getJNDIConnectionWrapper().bind( monitor );
ConnectionEventRegistry.fireConnectionOpened( connections[i], this );
}
}
// execute job
if ( !monitor.errorsReported() )
{
try
{
executeAsyncJob( monitor );
}
catch ( Exception e )
{
monitor.reportError( e );
}
finally
{
monitor.done();
ipm.done();
}
}
// error handling
if ( monitor.isCanceled() )
{
// System.out.println("Job: CANCEL+CANCEL");
externalResult = Status.CANCEL_STATUS;
return Status.CANCEL_STATUS;
}
else if ( monitor.errorsReported() )
{
externalResult = monitor.getErrorStatus( getErrorMessage() );
if ( externalProgressMonitor == null )
{
// System.out.println("Job: ERROR+ERROR");
return externalResult;
}