JAL-629 make sure we show GUI when not driven programmatically
authorJames Procter <j.procter@dundee.ac.uk>
Wed, 22 Feb 2023 13:34:54 +0000 (13:34 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Wed, 22 Feb 2023 13:34:54 +0000 (13:34 +0000)
src/jalview/gui/StructureChooser.java

index 9f259bb..04cc94e 100644 (file)
@@ -119,18 +119,18 @@ public class StructureChooser extends GStructureChooser
 
   List<SequenceI> seqsWithoutSourceDBRef = null;
 
-  private boolean noChooserGUI = false;
+  private boolean showChooserGUI = true;
 
   private static StructureViewer lastTargetedView = null;
 
   public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
           AlignmentPanel ap)
   {
-    this(selectedSeqs, selectedSeq, ap, false);
+    this(selectedSeqs, selectedSeq, ap, true);
   }
 
   public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
-          AlignmentPanel ap, boolean noChooserGUI)
+          AlignmentPanel ap, boolean showGUI)
   {
     // which FTS engine to use
     data = StructureChooserQuerySource.getQuerySourceFor(selectedSeqs);
@@ -140,7 +140,7 @@ public class StructureChooser extends GStructureChooser
     this.selectedSequence = selectedSeq;
     this.selectedSequences = selectedSeqs;
     this.progressIndicator = (ap == null) ? null : ap.alignFrame;
-    this.noChooserGUI = noChooserGUI;
+    this.showChooserGUI = showGUI;
     init();
 
   }
@@ -256,7 +256,7 @@ public class StructureChooser extends GStructureChooser
     populateFilterComboBox(isStructuresDiscovered(), cachedPDBExists);
     discoverStructureViews();
     updateProgressIndicator(null, startTime);
-    mainFrame.setVisible(noChooserGUI);
+    mainFrame.setVisible(showChooserGUI);
     updateCurrentView();
   }
 
@@ -1586,8 +1586,9 @@ public class StructureChooser extends GStructureChooser
   public static void openStructureFileForSequence(AlignmentPanel ap,
           SequenceI seq, File sFile)
   {
+    //Open the chooser headlessly. Not sure this is actually needed ?
     StructureChooser sc = new StructureChooser(new SequenceI[] { seq }, seq,
-            ap, true);
+            ap, false);
     StructureSelectionManager ssm = ap.getStructureSelectionManager();
     PDBEntry fileEntry = null;
     try
@@ -1606,7 +1607,6 @@ public class StructureChooser extends GStructureChooser
             new PDBEntry[]
             { fileEntry }, ap, new SequenceI[] { seq });
 
-    sc.mainFrame.dispose();
-    sc.noChooserGUI = false;
+    sc.mainFrame.dispose(); 
   }
 }