From: Jim Procter Date: Thu, 5 Apr 2018 13:27:29 +0000 (+0100) Subject: JAL-2944 methods to check existence and get a title for existing or to-be-created... X-Git-Tag: Release_2_10_4~32^2~14 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b927b6af7e5654e0df7e2dbaa337322f2b52940f;p=jalview.git JAL-2944 methods to check existence and get a title for existing or to-be-created StructureViewer --- diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index 8b501ad..b7767fa 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -75,6 +75,16 @@ public class StructureViewer sv.sview = display; return sv; } + + @Override + public String toString() + { + if (sview != null) + { + return sview.toString(); + } + return "New View"; + } public ViewerType getViewerType() { String viewType = Cache.getDefault(Preferences.STRUCTURE_DISPLAY, @@ -343,4 +353,24 @@ public class StructureViewer return false; } + /** + * + * @param pDBid + * @return true if view is already showing PDBid + */ + public boolean hasPdbId(String pDBid) + { + if (sview == null) + { + return false; + } + + return sview.getBinding().hasPdbId(pDBid); + } + + public boolean isVisible() + { + return sview != null && sview.isVisible(); + } + }