JAL-1894 update year/version in copyright
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index 9dd730c..74cab59 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b1)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -21,7 +21,6 @@
 package jalview.structure;
 
 import jalview.analysis.AlignSeq;
-import jalview.api.AlignmentViewPanel;
 import jalview.api.StructureSelectionManagerProvider;
 import jalview.commands.CommandI;
 import jalview.commands.EditCommand;
@@ -33,8 +32,6 @@ import jalview.datamodel.Annotation;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SearchResults;
 import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
 import jalview.io.AppletFormatAdapter;
 import jalview.util.MappingUtils;
 import jalview.util.MessageManager;
@@ -73,7 +70,7 @@ public class StructureSelectionManager
   /*
    * Set of any registered mappings between (dataset) sequences.
    */
-  Set<AlignedCodonFrame> seqmappings = new LinkedHashSet<AlignedCodonFrame>();
+  public Set<AlignedCodonFrame> seqmappings = new LinkedHashSet<AlignedCodonFrame>();
 
   private List<CommandListener> commandListeners = new ArrayList<CommandListener>();
 
@@ -517,7 +514,8 @@ public class StructureSelectionManager
           resNum = tmp.resNumber;
           if (tmp.alignmentMapping >= -1)
           {
-            // TODO (JAL-1836) address root cause: negative residue no in PDB file
+            // TODO (JAL-1836) address root cause: negative residue no in PDB
+            // file
             mapping[tmp.alignmentMapping + 1][0] = tmp.resNumber;
             mapping[tmp.alignmentMapping + 1][1] = tmp.atomIndex;
           }
@@ -722,7 +720,7 @@ public class StructureSelectionManager
               {
                 results = MappingUtils.buildSearchResults(seq, index,
                         seqmappings);
-               }
+              }
               if (handlingVamsasMo)
               {
                 results.addResult(seq, index, index);
@@ -912,31 +910,13 @@ public class StructureSelectionManager
   }
 
   /**
-   * Deregister each mapping in the set, unless there is still an alignment that
-   * holds a reference to it. Note we do not update the set itself, as it may be
-   * shared with an alignment view which is still open.
-   * 
-   * @param set
-   */
-  public void deregisterMappings(Set<AlignedCodonFrame> set)
-  {
-    if (set != null)
-    {
-      for (AlignedCodonFrame acf : set)
-      {
-        deregisterMapping(acf);
-      }
-    }
-  }
-
-  /**
-   * Remove the given mapping provided no alignment holds a reference to it
+   * Remove the given mapping
    * 
    * @param acf
    */
   public void deregisterMapping(AlignedCodonFrame acf)
   {
-    if (noReferencesTo(acf))
+    if (acf != null)
     {
       boolean removed = seqmappings.remove(acf);
       if (removed && seqmappings.isEmpty())
@@ -947,33 +927,6 @@ public class StructureSelectionManager
   }
 
   /**
-   * Answers true if no alignment holds a reference to the given mapping
-   * 
-   * @param acf
-   * @return
-   */
-  protected boolean noReferencesTo(AlignedCodonFrame acf)
-  {
-    AlignFrame[] frames = Desktop.getAlignFrames();
-    if (frames == null)
-    {
-      return true;
-    }
-    for (AlignFrame af : frames)
-    {
-      for (AlignmentViewPanel ap : af.getAlignPanels())
-      {
-        AlignmentI al = ap.getAlignment();
-        if (al != null && al.getCodonFrames().contains(acf))
-        {
-          return false;
-        }
-      }
-    }
-    return true;
-  }
-
-  /**
    * Add each of the given codonFrames to the stored set, if not aready present.
    * 
    * @param set