From: James Procter Date: Thu, 7 Sep 2023 16:00:19 +0000 (+0100) Subject: JAL-4279 suppress error dialogs raised by file loader when working in batch mode X-Git-Tag: Release_2_11_4_0~182 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=00295142757dcaa892733bc104547e41f5078814;p=jalview.git JAL-4279 suppress error dialogs raised by file loader when working in batch mode --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index efd2177..eabad91 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -1978,4 +1978,9 @@ public class Jalview return bootstrapArgs; } + public static boolean isBatchMode() + { + return getInstance()!=null && (getInstance().desktop == null || getInstance().desktop.isInBatchMode()); + } + } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index bf79fa4..dc7adac 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -325,7 +325,7 @@ public class FileLoader implements Runnable Desktop.instance.stopLoading(); jalview.bin.Console.errPrintln("The input file \"" + file + "\" has null or unidentifiable data content!"); - if (!Jalview.isHeadlessMode()) + if (!Jalview.isHeadlessMode() && !Jalview.isBatchMode()) { JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager.getString("label.couldnt_read_data") @@ -361,7 +361,7 @@ public class FileLoader implements Runnable // We read the data anyway - it might make sense. } // BH 2018 switch to File object here instead of filename - alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign( + alignFrame = new Jalview2XML(raiseGUI && !Jalview.isBatchMode()).loadJalviewAlign( selectedFile == null ? file : selectedFile); } else @@ -537,7 +537,7 @@ public class FileLoader implements Runnable "label.couldnt_load_file") + " " + title + "\n" + error; // TODO: refactor FileLoader to be independent of Desktop / Applet GUI // bits ? - if (raiseGUI && Desktop.desktop != null) + if (raiseGUI && !Jalview.isBatchMode() && Desktop.desktop != null) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @@ -565,7 +565,7 @@ public class FileLoader implements Runnable { jalview.bin.Console.errPrintln("Exception whilst opening file '" + file); er.printStackTrace(); - if (raiseGUI) + if (raiseGUI && !Jalview.isBatchMode()) { javax.swing.SwingUtilities.invokeLater(new Runnable() { @@ -587,7 +587,7 @@ public class FileLoader implements Runnable er.printStackTrace(); alignFrame = null; - if (raiseGUI) + if (raiseGUI && !Jalview.isBatchMode()) { javax.swing.SwingUtilities.invokeLater(new Runnable() {