JAL-3010 fix up bad merge from develop
[jalview.git] / src / jalview / controller / AlignViewController.java
index 5662d0c..cacde84 100644 (file)
@@ -157,7 +157,7 @@ public class AlignViewController implements AlignViewControllerI
 
   @Override
   public boolean markColumnsContainingFeatures(boolean invert,
-          boolean extendCurrent, boolean toggle, String featureType)
+          boolean extendCurrent, boolean toggle, String... featureType)
   {
     // JBPNote this routine could also mark rows, not just columns.
     // need a decent query structure to allow all types of feature searches
@@ -166,7 +166,7 @@ public class AlignViewController implements AlignViewControllerI
             || extendCurrent) ? viewport.getAlignment()
                     : viewport.getSelectionGroup();
 
-    int nseq = findColumnsWithFeature(featureType, sqcol, bs);
+    int nseq = findColumnsWithFeature(sqcol, bs, featureType);
 
     ColumnSelection cs = viewport.getColumnSelection();
     if (cs == null)
@@ -174,6 +174,9 @@ public class AlignViewController implements AlignViewControllerI
       cs = new ColumnSelection();
     }
 
+    String featureTypeString = featureType.length == 1 ? featureType[0]
+            : featureType.toString();
+
     if (bs.cardinality() > 0 || invert)
     {
       boolean changed = cs.markColumns(bs, sqcol.getStartRes(),
@@ -194,7 +197,7 @@ public class AlignViewController implements AlignViewControllerI
                     invert ? MessageManager
                             .getString("label.not_containing")
                             : MessageManager.getString("label.containing"),
-                    featureType, Integer.valueOf(nseq).toString() }));
+                    featureTypeString, Integer.valueOf(nseq).toString() }));
         return true;
       }
     }
@@ -202,7 +205,7 @@ public class AlignViewController implements AlignViewControllerI
     {
       avcg.setStatus(MessageManager
               .formatMessage("label.no_feature_of_type_found", new String[]
-              { featureType }));
+              { featureTypeString }));
       if (!extendCurrent)
       {
         cs.clear();
@@ -214,17 +217,18 @@ public class AlignViewController implements AlignViewControllerI
 
   /**
    * Sets a bit in the BitSet for each column (base 0) in the sequence
-   * collection which includes a visible feature of the specified feature type.
-   * Returns the number of sequences which have the feature visible in the
-   * selected range.
+   * collection which includes a visible feature of the specified feature
+   * type(s). Returns the number of sequences which have the feature(s) visible
+   * in the selected range.
    * 
-   * @param featureType
    * @param sqcol
    * @param bs
+   * @param featureType
+   * 
    * @return
    */
-  int findColumnsWithFeature(String featureType,
-          SequenceCollectionI sqcol, BitSet bs)
+  int findColumnsWithFeature(SequenceCollectionI sqcol,
+          BitSet bs, String... featureType)
   {
     FeatureRenderer fr = alignPanel == null ? null : alignPanel
             .getFeatureRenderer();
@@ -352,25 +356,25 @@ public class AlignViewController implements AlignViewControllerI
   public boolean parseFeaturesFile(String file, DataSourceType protocol,
           boolean relaxedIdMatching)
   {
-    boolean featuresFile = false;
+    boolean featuresAdded = false;
+    FeatureRenderer fr = alignPanel.getFeatureRenderer();
     try
     {
-      featuresFile = new FeaturesFile(false, file, protocol).parse(
-              viewport.getAlignment().getDataset(),
-              alignPanel.getFeatureRenderer().getFeatureColours(), false,
-              relaxedIdMatching);
+      featuresAdded = new FeaturesFile(false, file, protocol).parse(
+              viewport.getAlignment().getDataset(), fr.getFeatureColours(),
+              fr.getFeatureFilters(), false, relaxedIdMatching);
     } catch (Exception ex)
     {
       ex.printStackTrace();
     }
 
-    if (featuresFile)
+    if (featuresAdded)
     {
       avcg.refreshFeatureUI(true);
-      if (alignPanel.getFeatureRenderer() != null)
+      if (fr != null)
       {
         // update the min/max ranges where necessary
-        alignPanel.getFeatureRenderer().findAllFeatures(true);
+        fr.findAllFeatures(true);
       }
       if (avcg.getFeatureSettingsUI() != null)
       {
@@ -379,7 +383,7 @@ public class AlignViewController implements AlignViewControllerI
       alignPanel.paintAlignment(true, true);
     }
 
-    return featuresFile;
+    return featuresAdded;
 
   }