JAL-4290 Set structureSelectionManager settings more generically and when no desktop...
[jalview.git] / src / jalview / gui / Desktop.java
index a2a344c..bbd4dae 100644 (file)
@@ -680,22 +680,7 @@ public class Desktop extends jalview.jbgui.GDesktop
     // configure services
     StructureSelectionManager ssm = StructureSelectionManager
             .getStructureSelectionManager(this);
-    if (Cache.getDefault(Preferences.ADD_SS_ANN, true))
-    {
-      ssm.setAddTempFacAnnot(
-              Cache.getDefault(Preferences.ADD_TEMPFACT_ANN, true));
-      ssm.setProcessSecondaryStructure(
-              Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
-      // JAL-3915 - RNAView is no longer an option so this has no effect
-      ssm.setSecStructServices(
-              Cache.getDefault(Preferences.USE_RNAVIEW, false));
-    }
-    else
-    {
-      ssm.setAddTempFacAnnot(false);
-      ssm.setProcessSecondaryStructure(false);
-      ssm.setSecStructServices(false);
-    }
+    StructureSelectionManager.doConfigureStructurePrefs(ssm);
   }
 
   public void checkForNews()
@@ -1518,7 +1503,21 @@ public class Desktop extends jalview.jbgui.GDesktop
     {
       // suppress a possible repeat prompt to save script
       groovyConsole.setDirty(false);
-      groovyConsole.exit();
+
+      // and tidy up
+      if (((Window) groovyConsole.getFrame()) != null
+              && ((Window) groovyConsole.getFrame()).isVisible())
+      {
+        // console is visible -- FIXME JAL-4327
+        groovyConsole.exit();
+      }
+      else
+      {
+        // console is not, so just let it dispose itself when we shutdown
+        // we don't call groovyConsole.exit() because it calls the shutdown
+        // handler with invokeAndWait() causing deadlock
+        groovyConsole = null;
+      }
     }
 
     if (terminateJvm)