Merge branch 'develop' into bug/JAL-4290_headless_alignment_export_with_structure_ann...
[jalview.git] / src / jalview / bin / Commands.java
index a72da0d..b6a5a25 100644 (file)
@@ -331,9 +331,17 @@ public class Commands
           }
 
           // colour alignment
-          String colour = avm.getFromSubValArgOrPref(av, Arg.COLOUR, sv,
-                  null, "DEFAULT_COLOUR_PROT", "");
-          this.colourAlignFrame(af, colour);
+          String colour = null;
+          if (avm.containsArg(Arg.COLOUR)
+                  || !(format == FileFormat.Jalview))
+          {
+            colour = avm.getFromSubValArgOrPref(av, Arg.COLOUR, sv, null,
+                    "DEFAULT_COLOUR_PROT", null);
+          }
+          if (colour != null)
+          {
+            this.colourAlignFrame(af, colour);
+          }
 
           // Change alignment frame title
           String title = avm.getFromSubValArgOrPref(av, Arg.TITLE, sv, null,
@@ -1293,8 +1301,19 @@ public class Commands
 
   private void colourAlignFrame(AlignFrame af, ColourSchemeI cs)
   {
-    // Note that cs == null removes colour scheme from af
-    af.changeColour(cs);
+    try {
+    SwingUtilities.invokeAndWait(new Runnable()
+    {
+      @Override
+      public void run()
+      {
+        // Note that cs == null removes colour scheme from af
+        af.changeColour(cs);
+      }
+    }); } catch (Exception x) {
+      Console.trace("Interrupted whilst waiting for colorAlignFrame action",x);
+      
+    }
   }
 
   private ColourSchemeI getColourScheme(AlignFrame af)