From 7fa567506eea0a202c71e6939b961962f515dcec Mon Sep 17 00:00:00 2001 From: James Procter Date: Mon, 23 Oct 2023 14:03:45 +0100 Subject: [PATCH] JAL-4310 let the user know when model pages are not available for a 3d-beacons structure (and log URLs when they are opened). --- src/jalview/gui/Desktop.java | 8 +++++++- src/jalview/gui/StructureChooser.java | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 35afb69..070e67d 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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."); + } + } /** diff --git a/src/jalview/gui/StructureChooser.java b/src/jalview/gui/StructureChooser.java index a72e221..8135019 100644 --- a/src/jalview/gui/StructureChooser.java +++ b/src/jalview/gui/StructureChooser.java @@ -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 -- 1.7.10.2