develop merge
[jalview.git] / src / jalview / controller / AlignViewController.java
index 6a7e222..ca2ae6d 100644 (file)
@@ -37,7 +37,6 @@ import jalview.io.FeaturesFile;
 import jalview.util.MessageManager;
 
 import java.awt.Color;
-import java.util.ArrayList;
 import java.util.BitSet;
 import java.util.List;
 
@@ -317,46 +316,23 @@ public class AlignViewController implements AlignViewControllerI
   }
 
   @Override
-  public void sortAlignmentByFeatureDensity(String[] typ)
+  public void sortAlignmentByFeatureDensity(List<String> typ)
   {
     sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY);
   }
 
-  protected void sortBy(String[] typ, String methodText, final String method)
+  protected void sortBy(List<String> typ, String methodText,
+          final String method)
   {
     FeatureRenderer fr = alignPanel.getFeatureRenderer();
-    if (typ == null)
+    if (typ == null && fr != null)
     {
-      typ = fr == null ? null : fr.getDisplayedFeatureTypes();
+      typ = fr.getDisplayedFeatureTypes();
     }
-    String gps[] = null;
-    gps = fr == null ? null : fr.getDisplayedFeatureGroups();
-    if (typ != null)
+    List<String> gps = null;
+    if (fr != null)
     {
-      List<String> types = new ArrayList<String>();
-      for (String displayed : typ)
-      {
-        if (displayed != null)
-        {
-          types.add(displayed);
-        }
-      }
-      typ = new String[types.size()];
-      types.toArray(typ);
-    }
-    if (gps != null)
-    {
-      List<String> grps = new ArrayList<String>();
-
-      for (int i = 0; i < gps.length; i++)
-      {
-        if (gps[i] != null)
-        {
-          grps.add(gps[i]);
-        }
-      }
-      gps = new String[grps.size()];
-      grps.toArray(gps);
+      gps = fr.getDisplayedFeatureGroups();
     }
     AlignmentI al = viewport.getAlignment();
 
@@ -381,7 +357,7 @@ public class AlignViewController implements AlignViewControllerI
   }
 
   @Override
-  public void sortAlignmentByFeatureScore(String[] typ)
+  public void sortAlignmentByFeatureScore(List<String> typ)
   {
     sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE);
   }
@@ -393,7 +369,7 @@ public class AlignViewController implements AlignViewControllerI
     boolean featuresFile = false;
     try
     {
-      featuresFile = new FeaturesFile(file, protocol).parse(viewport
+      featuresFile = new FeaturesFile(false, file, protocol).parse(viewport
               .getAlignment().getDataset(), alignPanel.getFeatureRenderer()
               .getFeatureColours(), false, relaxedIdMatching);
     } catch (Exception ex)