Merge branch 'bug/JAL-3120restoreFeatureColour' into merge/JAL-3120
[jalview.git] / src / jalview / project / Jalview2XML.java
index 9980e04..53e9a83 100644 (file)
@@ -551,24 +551,19 @@ public class Jalview2XML
   public void saveState(File statefile)
   {
     FileOutputStream fos = null;
-    // create backupfiles object and get new temp filename destination
-    BackupFiles backupfiles = new BackupFiles(statefile);
 
     try
     {
 
-      fos = new FileOutputStream(backupfiles.getTempFilePath());
+      fos = new FileOutputStream(statefile);
 
       JarOutputStream jout = new JarOutputStream(fos);
       saveState(jout);
       fos.close();
-      backupfiles.setWriteSuccess(true);
-      backupfiles.rollBackupsAndRenameTempFile();
 
     } catch (Exception e)
     {
-      Cache.log.error("Couln't write Jalview state to " + statefile
-              + ". Temporary file is at: " + backupfiles.getTempFile(), e);
+      Cache.log.error("Couln't write Jalview state to " + statefile, e);
       // TODO: inform user of the problem - they need to know if their data was
       // not saved !
       if (errorMessage == null)
@@ -579,8 +574,7 @@ public class Jalview2XML
       else
       {
         errorMessage += "(Didn't write Jalview Archive to output file '"
-                + statefile + "\nTemporary file is at: "
-                + backupfiles.getTempFile() + ")";
+                + statefile + ")";
       }
       e.printStackTrace();
     } finally
@@ -5073,7 +5067,8 @@ public class Jalview2XML
           float min = safeFloat(safeFloat(setting.getMin()));
           float max = setting.getMax() == null ? 1f
                   : setting.getMax().floatValue();
-          FeatureColourI gc = new FeatureColour(minColour, maxColour,
+          FeatureColourI gc = new FeatureColour(maxColour, minColour,
+                  maxColour,
                   noValueColour, min, max);
           if (setting.getAttributeName().size() > 0)
           {
@@ -5841,15 +5836,16 @@ public class Jalview2XML
     jalview.datamodel.Mapping jmap = new jalview.datamodel.Mapping(dsto, fr,
             fto, m.getMapFromUnit().intValue(),
             m.getMapToUnit().intValue());
-    // if (m.getMappingChoice() != null)
-    // {
-    // MappingChoice mc = m.getMappingChoice();
+
+    /*
+     * (optional) choice of dseqFor or Sequence
+     */
     if (m.getDseqFor() != null)
     {
       String dsfor = m.getDseqFor();
       if (seqRefIds.containsKey(dsfor))
       {
-        /**
+        /*
          * recover from hash
          */
         jmap.setTo(seqRefIds.get(dsfor));
@@ -5859,9 +5855,9 @@ public class Jalview2XML
         frefedSequence.add(newMappingRef(dsfor, jmap));
       }
     }
-    else
+    else if (m.getSequence() != null)
     {
-      /**
+      /*
        * local sequence definition
        */
       Sequence ms = m.getSequence();
@@ -6567,7 +6563,7 @@ public class Jalview2XML
         noValueColour = maxcol;
       }
   
-      colour = new FeatureColour(mincol, maxcol, noValueColour,
+      colour = new FeatureColour(maxcol, mincol, maxcol, noValueColour,
               safeFloat(colourModel.getMin()),
               safeFloat(colourModel.getMax()));
       final List<String> attributeName = colourModel.getAttributeName();