JAL-2360 structure viewers now using ColourMenuHelper, obsolete methods
[jalview.git] / src / jalview / schemes / ResidueColourScheme.java
index 9cc4bd1..57f7d57 100755 (executable)
@@ -40,6 +40,8 @@ public abstract class ResidueColourScheme implements ColourSchemeI
 {
   public static final String NONE = "None";
 
+  public static final String USER_DEFINED = "User Defined";
+
   /*
    * lookup up by character value e.g. 'G' to the colors array index
    * e.g. if symbolIndex['K'] = 11 then colors[11] is the colour for K
@@ -360,12 +362,16 @@ public abstract class ResidueColourScheme implements ColourSchemeI
     }
 
     /*
-     * inspect the data context (alignment dataset) for residue type
+     * inspect the data context (alignment) for residue type
      */
     boolean nucleotide = false;
-    AnnotatedCollectionI context = ac.getContext();
-    if (context != null)
+    if (ac instanceof AlignmentI)
+    {
+      nucleotide = ((AlignmentI) ac).isNucleotide();
+    }
+    else
     {
+      AnnotatedCollectionI context = ac.getContext();
       if (context instanceof AlignmentI)
       {
         nucleotide = ((AlignmentI) context).isNucleotide();
@@ -376,14 +382,6 @@ public abstract class ResidueColourScheme implements ColourSchemeI
         return true;
       }
     }
-    else if (ac instanceof AlignmentI)
-    {
-      nucleotide = ((AlignmentI) ac).isNucleotide();
-    }
-    else
-    {
-      return true;
-    }
 
     /*
      * does data type match colour scheme type?
@@ -411,4 +409,14 @@ public abstract class ResidueColourScheme implements ColourSchemeI
   {
     return false;
   }
+
+  /**
+   * Default method returns true. Override this to return false in colour
+   * schemes that are not determined solely by the sequence symbol.
+   */
+  @Override
+  public boolean isSimple()
+  {
+    return true;
+  }
 }