From: James Procter Date: Wed, 6 Sep 2023 11:28:10 +0000 (+0100) Subject: JAL-629 reinstate INFO level stack trace from StructureChooser service exceptions... X-Git-Tag: Release_2_11_4_0~192 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=527b7350892dd513becf6007623996498119ab57;p=jalview.git JAL-629 reinstate INFO level stack trace from StructureChooser service exceptions and suppress external service queries when viewing structures via Command-line import --- diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index cbf381a..a72e221 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -139,6 +139,10 @@ public class StructureChooser extends GStructureChooser List seqsWithoutSourceDBRef = null; private boolean showChooserGUI = true; + /** + * when true, queries to external services are supressed (no SIFTs, no PDBe, no 3D-Beacons, etc) + */ + private boolean dontQueryServices = false; private static StructureViewer lastTargetedView = null; @@ -151,6 +155,13 @@ public class StructureChooser extends GStructureChooser public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq, AlignmentPanel ap, boolean showGUI) { + this(selectedSeqs, selectedSeq, ap, showGUI, false); + } + + public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq, + AlignmentPanel ap, boolean showGUI, boolean dontQueryServices) + { + // which FTS engine to use data = StructureChooserQuerySource.getQuerySourceFor(selectedSeqs); initDialog(); @@ -160,6 +171,7 @@ public class StructureChooser extends GStructureChooser this.selectedSequences = selectedSeqs; this.progressIndicator = (ap == null) ? null : ap.alignFrame; this.showChooserGUI = showGUI; + this.dontQueryServices = dontQueryServices; init(); } @@ -231,17 +243,21 @@ public class StructureChooser extends GStructureChooser } }); - Executors.defaultThreadFactory().newThread(new Runnable() + if (!dontQueryServices) { - @Override - public void run() + Executors.defaultThreadFactory().newThread(new Runnable() { - populateSeqsWithoutSourceDBRef(); - initialStructureDiscovery(); - } - - }).start(); + @Override + public void run() + { + populateSeqsWithoutSourceDBRef(); + initialStructureDiscovery(); + } + }).start(); + } else { + Console.debug("Structure chooser not querying services to discover metadata."); + } } // called by init @@ -506,7 +522,7 @@ public class StructureChooser extends GStructureChooser } } catch (Exception e) { - Console.debugPrintStackTrace(e); + Console.printStackTrace(e); errors.add(e.getMessage()); continue; } @@ -1792,7 +1808,8 @@ public class StructureChooser extends GStructureChooser { // headless = true; prompt = false; - sc = new StructureChooser(new SequenceI[] { seq }, seq, ap, false); + // suppress structure viewer's external service queries + sc = new StructureChooser(new SequenceI[] { seq }, seq, ap, false,true); } if (ssm == null) {