From fa8a0ce92e350f285da4e02da130e2cc1ffee85a Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 1 Oct 2021 17:36:35 +0100 Subject: [PATCH] =?utf8?q?JAL-3616=20show=20name=20of=20structure=20viewer=20?= =?utf8?q?in=20=E2=80=98new=20view=E2=80=99=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- resources/lang/Messages.properties | 1 + src/jalview/gui/StructureViewer.java | 8 +++++++- src/jalview/jbgui/GStructureChooser.java | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 555bfbf..46ebb73 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -118,6 +118,7 @@ action.paste_annotations = Paste Annotations action.format = Format action.select = Select action.new_view = New View +action.new_structure_view_with = Open new structure view with {0} action.close = Close action.add = Add action.save_as = Save as... diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index 617706a..7b1864b 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -80,6 +80,7 @@ public class StructureViewer return sv; } + @Override public String toString() { @@ -89,7 +90,11 @@ public class StructureViewer } return "New View"; } - public ViewerType getViewerType() + /** + * + * @return ViewerType for currently configured structure viewer + */ + public static ViewerType getViewerType() { String viewType = Cache.getDefault(Preferences.STRUCTURE_DISPLAY, ViewerType.JMOL.name()); @@ -366,6 +371,7 @@ public class StructureViewer return viewer; } + public boolean isBusy() { if (sview != null) diff --git a/src/jalview/jbgui/GStructureChooser.java b/src/jalview/jbgui/GStructureChooser.java index ccccfb4..70d99c1 100644 --- a/src/jalview/jbgui/GStructureChooser.java +++ b/src/jalview/jbgui/GStructureChooser.java @@ -465,7 +465,9 @@ public abstract class GStructureChooser extends JPanel } }); - btn_newView = new JButton(MessageManager.getString("action.new_view")); + btn_newView = new JButton( + MessageManager.formatMessage("action.new_structure_view_with", + StructureViewer.getViewerType().toString())); btn_newView.setFont(VERDANA_12); btn_newView.addActionListener(new java.awt.event.ActionListener() { @@ -486,6 +488,8 @@ public abstract class GStructureChooser extends JPanel } } }); + + // TODO: JAL-3898 - get list of available external programs to view structures with btn_add = new JButton(MessageManager.getString("action.add")); btn_add.setFont(VERDANA_12); -- 1.7.10.2