From 527b7350892dd513becf6007623996498119ab57 Mon Sep 17 00:00:00 2001 From: James Procter Date: Wed, 6 Sep 2023 12:28:10 +0100 Subject: [PATCH] JAL-629 reinstate INFO level stack trace from StructureChooser service exceptions and suppress external service queries when viewing structures via Command-line import --- src/jalview/gui/StructureChooser.java | 37 ++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 10 deletions(-) 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) { -- 1.7.10.2