int retCode = d.open();
final ByteArrayOutputStream output = new ByteArrayOutputStream();
if (retCode == InputDialog.OK) {
ProgressMonitorDialog monitorDialog = new AsynchronousProgressMonitorDialog(getShell());
monitorDialog.setBlockOnOpen(false);
final Exception[] exception = new Exception[1];
try {
IRunnableWithProgress operation = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) throws InvocationTargetException,
InterruptedException {
monitor.beginTask("Restoring PYTHONPATH", IProgressMonitor.UNKNOWN);
IPythonInterpreter interpreter = JythonPlugin
.newPythonInterpreter(false, false);
interpreter.setErr(output);
interpreter.setOut(output);
HashMap<String, Object> locals = new HashMap<String, Object>();
locals.put("api_file", filePath);
locals.put("parts_for_module", d.getValue());
locals.put("cancel_monitor", monitor);
try {
JythonPlugin.exec(locals, "convert_api_to_pypredef.py", interpreter);
} catch (Exception e) {
Log.log(e + "\n\n" + output.toString());
exception[0] = e;
}
monitor.done();
}
};
monitorDialog.run(true, true, operation);
} catch (Exception e) {
Log.log(e);
}