JAL-2944 pull up structure viewer discovery routine to Desktop
[jalview.git] / src / jalview / gui / StructureViewerBase.java
index 93d675a..0b45417 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.gui;
 
+import jalview.api.AlignmentViewPanel;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
@@ -402,8 +403,15 @@ public abstract class StructureViewerBase extends GStructureViewer
     return getBinding().hasPdbId(pdbId);
   }
 
-  protected abstract List<StructureViewerBase> getViewersFor(
-          AlignmentPanel alp);
+  /**
+   * Returns a list of any viewer of the instantiated type. The list is
+   * restricted to those linked to the given alignment panel if it is not null.
+   */
+  protected List<StructureViewerBase> getViewersFor(AlignmentPanel alp)
+  {
+    return Desktop.instance.getStructureViewers(alp, this.getClass());
+  }
+
 
   /**
    * Check for any existing views involving this alignment and give user the