JAL-3081 restore annotation ordering from project (work in progress)
[jalview.git] / src / jalview / gui / AlignmentPanel.java
index 502ab9d..c606b9f 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.gui;
 
 import jalview.analysis.AnnotationSorter;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
 import jalview.bin.Cache;
@@ -821,14 +822,18 @@ public class AlignmentPanel extends GAlignmentPanel implements
   }
 
   /**
-   * Sorts annotations according to currently selected preference
+   * Sorts annotations according to currently selected preferences. Does nothing
+   * if currently set to 'Custom' (manual) ordering.
    */
   void sortAnnotations()
   {
-    final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
-            av.isShowAutocalculatedAbove());
-    sorter.sort(getAlignment().getAlignmentAnnotation(),
-            av.getSortAnnotationsBy());
+    SequenceAnnotationOrder sortBy = av.getSortAnnotationsBy();
+    if (sortBy != SequenceAnnotationOrder.CUSTOM)
+    {
+      final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
+              av.isShowAutocalculatedAbove());
+      sorter.sort(getAlignment().getAlignmentAnnotation(), sortBy);
+    }
   }
 
   /**