Merge branch 'develop' into features/JAL-2295setChimeraAttributes
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index b3968a3..27ff242 100644 (file)
@@ -806,7 +806,28 @@ public class StructureSelectionManager
       return;
     }
 
-    SearchResultsI results = new SearchResults();
+    SearchResultsI results = findAlignmentPositionsForStructurePositions(atoms);
+    for (Object li : listeners)
+    {
+      if (li instanceof SequenceListener)
+      {
+        ((SequenceListener) li).highlightSequence(results);
+      }
+    }
+  }
+
+  /**
+   * Constructs a SearchResults object holding regions (if any) in the Jalview
+   * alignment which have a mapping to the structure viewer positions in the
+   * supplied list
+   * 
+   * @param atoms
+   * @return
+   */
+  public SearchResults findAlignmentPositionsForStructurePositions(
+          List<AtomSpec> atoms)
+  {
+    SearchResults results = new SearchResults();
     for (AtomSpec atom : atoms)
     {
       SequenceI lastseq = null;
@@ -831,13 +852,7 @@ public class StructureSelectionManager
         }
       }
     }
-    for (Object li : listeners)
-    {
-      if (li instanceof SequenceListener)
-      {
-        ((SequenceListener) li).highlightSequence(results);
-      }
-    }
+    return results;
   }
 
   /**