throw new RuntimeException("Concurrent job invocation");
}
final Object[] retSuccess = new Object[1];
final Throwable[] ret = new Exception[1];
final ProgressDialog dialog;
if (owner != null) { dialog = new ProgressDialog(owner); }
else { dialog = new ProgressDialog(JHylaFAX.getInstance()); }
Runnable runner = new Runnable() {
public void run()
{
try {
retSuccess[0] = job.run(new UserAbortProgressMonitor(dialog));
}
catch (Throwable e) {
ret[0] = e;
}
SwingUtilities.invokeLater(new Runnable() {
public void run() {
dialog.done();
}
});
}
};
// make sure no other jobs are started
jobRunning = true;
Thread t = new Thread(runner, "Job");
t.start();
// show blocking dialog
if (owner != null) { dialog.setLocationRelativeTo(owner); }
else { dialog.setLocationRelativeTo(JHylaFAX.getInstance()); }
dialog.setTitle(i18n.tr("HylaFAX Server"));
dialog.setModal(true);
dialog.showDialog();
// at this point t is guranteed to be finished
jobRunning = false;
// XXX what if the errordialog is displayed?