JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / schemes / RNAHelicesColourChooser.java
index ee9792a..b1b3c5a 100644 (file)
  */
 package jalview.schemes;
 
-import java.util.*;
-import java.awt.event.*;
-
 import jalview.api.AlignViewportI;
 import jalview.api.AlignmentViewPanel;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+
+import java.awt.event.ActionEvent;
+import java.util.Hashtable;
+import java.util.Vector;
 
 /**
  * Helps generate the colors for RNA secondary structure. Future: add option to
@@ -77,13 +78,21 @@ public class RNAHelicesColourChooser
     adjusting = true;
     Vector list = new Vector();
     int index = 1;
-    for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+    AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+    if (anns != null)
     {
-      String label = av.getAlignment().getAlignmentAnnotation()[i].label;
-      if (!list.contains(label))
-        list.addElement(label);
-      else
-        list.addElement(label + "_" + (index++));
+      for (int i = 0; i < anns.length; i++)
+      {
+        String label = anns[i].label;
+        if (!list.contains(label))
+        {
+          list.addElement(label);
+        }
+        else
+        {
+          list.addElement(label + "_" + (index++));
+        }
+      }
     }
 
     adjusting = false;
@@ -105,21 +114,7 @@ public class RNAHelicesColourChooser
 
     av.setGlobalColourScheme(rhc);
 
-    if (av.getAlignment().getGroups() != null)
-    {
-      for (SequenceGroup sg : ap.getAlignment().getGroups())
-      {
-        if (sg.cs == null)
-        {
-          continue;
-        }
-
-        sg.cs = new RNAHelicesColour(sg);
-
-      }
-    }
-
-    ap.paintAlignment(false);
+    ap.paintAlignment(true);
   }
 
   void reset()