Source:
<code>protected IStatus run(final IProgressMonitor monitor) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine started: " + getName()); <START> if (!setupEngine()) { <END> throw new ScriptEngineException("Unknown setup failure"); } fSetupDone = true; for (final Entry<String, Object> entry : fBufferedVariables.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } fBufferedVariables.clear(); fStackTrace.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_START); while ((!monitor.isCanceled()) && (!isTerminated())) { if (!fCodePieces.isEmpty()) { final Script piece = fCodePieces.remove(0); inject(piece, true, false); } else { synchronized (this) { if (!isTerminated()) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine idle: " + getName()); wait(); } catch (final InterruptedException e) { } } } } } discardCodePieces(); notifyExecutionListeners(null, IExecutionListener.ENGINE_END); teardownEngine(); fTerminated = true; synchronized (this) { notifyAll(); } if (isTerminated()) return Status.OK_STATUS; return Status.CANCEL_STATUS; } catch (ScriptEngineException e) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not setup script engine", e); } finally { discardCodePieces(); closeStreams(); Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine terminated: " + getName()); } }</code><technical_language>completely change API boolean setupEngine() void setupEngine() throws ScriptEngineException</technical_language>

Target:
protected IStatus run(final IProgressMonitor monitor) { IStatus returnStatus = Status.OK_STATUS; try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine started: " + getName()); setupEngine(); fSetupDone = true; for (final Entry<String, Object> entry : fBufferedVariables.entrySet()) { setVariable(entry.getKey(), entry.getValue()); } fBufferedVariables.clear(); fStackTrace.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_START); while ((!monitor.isCanceled()) && (!isTerminated())) { if (!fCodePieces.isEmpty()) { final Script piece = fCodePieces.remove(0); inject(piece, true, false); } else { synchronized (this) { if (!isTerminated()) { try { Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine idle: " + getName()); wait(); } catch (final InterruptedException e) { } } } } } if (!isTerminated()){ returnStatus = Status.OK_STATUS; } else { returnStatus = Status.CANCEL_STATUS; } } catch (ScriptEngineException e) { returnStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not setup script engine", e); } finally { synchronized (fCodePieces) { for (final Script script : fCodePieces) script.setException(new ExitException()); } fCodePieces.clear(); notifyExecutionListeners(null, IExecutionListener.ENGINE_END); try { teardownEngine(); } catch (ScriptEngineException e) { if (returnStatus.getSeverity() < IStatus.ERROR) { returnStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not teardown script engine", e); } } finally { fTerminated = true; synchronized (this) { notifyAll(); } synchronized (fCodePieces) { for (final Script script : fCodePieces) script.setException(new ExitException()); fCodePieces.clear(); } closeStreams(); Logger.trace(Activator.PLUGIN_ID, TRACE_SCRIPT_ENGINE, "Engine terminated: " + getName()); } } return returnStatus; }