JAL-4310 let the user know when model pages are not available for a 3d-beacons struct...
authorJames Procter <j.procter@dundee.ac.uk>
Mon, 23 Oct 2023 13:03:45 +0000 (14:03 +0100)
committerJames Procter <j.procter@dundee.ac.uk>
Mon, 23 Oct 2023 13:03:45 +0000 (14:03 +0100)
src/jalview/gui/Desktop.java
src/jalview/gui/StructureChooser.java

index 35afb69..070e67d 100644 (file)
@@ -3067,7 +3067,13 @@ public class Desktop extends jalview.jbgui.GDesktop
    */
   public static void showUrl(final String url)
   {
-    showUrl(url, Desktop.instance);
+    if (url!=null && !url.trim().equals("")) {
+      jalview.bin.Console.info("Opening URL: "+url);
+      showUrl(url, Desktop.instance);
+    } else {
+      jalview.bin.Console.warn("Ignoring attempt to show an empty URL.");
+    }
+    
   }
 
   /**
index a72e221..8135019 100644 (file)
@@ -1008,8 +1008,13 @@ public class StructureChooser extends GStructureChooser
               .getFTSDataFor(getResultTable(), selectedRow,
                       discoveredStructuresSet);
       String pageUrl = row.getModelViewUrl();
+      
       JPopupMenu popup = new JPopupMenu("3D Beacons");
       JMenuItem viewUrl = new JMenuItem("View model web page");
+      if (pageUrl == null || "".equals(pageUrl.trim())) {
+        viewUrl.setEnabled(false);
+        viewUrl.setText("No model page available.");
+      }
       viewUrl.addActionListener(new ActionListener()
       {
         @Override