import jalview.gui.ViewSelectionMenu.ViewSetProvider;
import jalview.io.DataSourceType;
import jalview.jbgui.GStructureViewer;
+import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
/**
* Base class with common functionality for JMol, Chimera or other structure
protected abstract boolean hasPdbId(String pdbId);
- protected abstract List<StructureViewerBase> getViewersFor(
- AlignmentPanel alp);
+ /**
+ * Returns a list of any structure viewers of the same type. The list is
+ * restricted to those linked to the given alignment panel if it is not null.
+ */
+ protected List<StructureViewerBase> getViewersFor(AlignmentPanel alp){
+
+ List<StructureViewerBase> result = new ArrayList<StructureViewerBase>();
+ JInternalFrame[] frames = Desktop.instance.getAllFrames();
+
+ for (JInternalFrame frame : frames)
+ {
+ if (this.getClass().isAssignableFrom(frame.getClass()))
+ {
+ if (alp == null
+ || ((StructureViewerBase) frame).isLinkedWith(alp))
+ {
+ result.add((StructureViewerBase) frame);
+ }
+ }
+ }
+ return result;
+
+ }
/**
* Check for any existing views involving this alignment and give user the
final AlignmentPanel apanel, String pdbId)
{
boolean finished = false;
- String alreadyMapped = apanel.getStructureSelectionManager()
- .alreadyMappedToFile(pdbId);
+ StructureSelectionManager ssm = apanel.getStructureSelectionManager();
+ String alreadyMapped = ssm.alreadyMappedToFile(pdbId);
if (alreadyMapped != null)
{