import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
.toLowerCase(Locale.ROOT);
final ImageExporter exporter = new ImageExporter(writer,
getProgressIndicator(), type, getTitle());
- // hack to pass back and throw to caller
+
final Throwable[] exceptions = new Throwable[1];
exceptions[0] = null;
final AppJmol us = this;
try
{
- SwingUtilities.invokeAndWait(new Runnable()
+ Thread runner = Executors.defaultThreadFactory().newThread(new Runnable()
{
@Override
public void run()
}
}
});
- } catch (InvocationTargetException e)
+ do { Thread.sleep(25); } while (runner.isAlive());
+ } catch (Throwable e)
{
throw new ImageOutputException(
"Unexpected error when generating image", e);
- } catch (InterruptedException e)
- {
- Console.debug("Interrupted whilst waiting for image export", e);
}
if (exceptions[0] != null)
{
*/
if (file == null && !Jalview.isHeadlessMode())
{
+ if (Desktop.instance.isInBatchMode())
+ {
+ // defensive error report - we could wait for user input.. I guess ?
+ throw(new ImageOutputException("Need an output file to render to when exporting images in batch mode!"));
+ }
JalviewFileChooser chooser = imageType.getFileChooser();
chooser.setFileView(new JalviewFileView());
MessageManager.formatMessage("label.create_image_of",