JAL-4310 let the user know when model pages are not available for a 3d-beacons struct...
[jalview.git] / src / jalview / gui / AppJmolBinding.java
index 2699db1..158bb54 100644 (file)
@@ -33,8 +33,8 @@ import org.openscience.jmol.app.jmolpanel.console.AppConsole;
 
 import jalview.api.AlignmentViewPanel;
 import jalview.api.structures.JalviewStructureDisplayI;
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentI;
+import jalview.bin.Console;
+import jalview.bin.Jalview;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.ext.jmol.JalviewJmolBinding;
@@ -42,9 +42,6 @@ import jalview.io.DataSourceType;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
-import jalview.ws.dbsources.EBIAlfaFold;
-import jalview.ws.dbsources.Pdb;
-import jalview.ws.utils.UrlDownloadClient;
 import javajs.util.BS;
 
 public class AppJmolBinding extends JalviewJmolBinding
@@ -91,7 +88,7 @@ public class AppJmolBinding extends JalviewJmolBinding
       jalview.util.BrowserLauncher.openURL(url);
     } catch (Exception e)
     {
-      Cache.error("Failed to launch Jmol-associated url " + url, e);
+      Console.error("Failed to launch Jmol-associated url " + url, e);
       // TODO: 2.6 : warn user if browser was not configured.
     }
   }
@@ -156,7 +153,7 @@ public class AppJmolBinding extends JalviewJmolBinding
   {
     jmolViewer.setJmolCallbackListener(this);
     // BH comment: can't do this yet [for JS only, or generally?]
-    return Platform.isJS() ? null
+    return Platform.isJS() || Jalview.isHeadlessMode() ? null
             : new AppConsole(jmolViewer, consolePanel, buttonsToShow);
   }
 
@@ -214,7 +211,7 @@ public class AppJmolBinding extends JalviewJmolBinding
   {
     // todo - record which pdbids were successfully imported.
     StringBuilder errormsgs = new StringBuilder();
-  
+
     List<String> files = new ArrayList<>();
     String pdbid = "";
     try
@@ -222,7 +219,7 @@ public class AppJmolBinding extends JalviewJmolBinding
       String[] filesInViewer = getStructureFiles();
       // TODO: replace with reference fetching/transfer code (validate PDBentry
       // as a DBRef?)
-      
+
       for (int pi = 0; pi < getPdbCount(); pi++)
       {
         PDBEntry strucEntry = getPdbEntry(pi);
@@ -231,7 +228,8 @@ public class AppJmolBinding extends JalviewJmolBinding
         if (file == null)
         {
           pdbid = strucEntry.getId();
-          try{ 
+          try
+          {
             file = structureViewer.fetchPdbFile(strucEntry);
           } catch (OutOfMemoryError oomerror)
           {
@@ -241,7 +239,7 @@ public class AppJmolBinding extends JalviewJmolBinding
             ex.printStackTrace();
             errormsgs.append("'").append(pdbid).append("'");
           }
-          if (file!=null)
+          if (file != null)
           {
             // success
             files.add(file);