JAL-629 reinstate INFO level stack trace from StructureChooser service exceptions...
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 6 Sep 2023 11:28:10 +0000 (12:28 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 6 Sep 2023 11:39:00 +0000 (12:39 +0100)
src/jalview/gui/StructureChooser.java

index cbf381a..a72e221 100644 (file)
@@ -139,6 +139,10 @@ public class StructureChooser extends GStructureChooser
   List<SequenceI> 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)
     {