import jalview.gui.ChimeraViewFrame;
import jalview.gui.Desktop;
import jalview.gui.FeatureRenderer;
-import jalview.gui.Jalview2XML_V1;
import jalview.gui.JvOptionPane;
import jalview.gui.OOMWarning;
import jalview.gui.PCAPanel;
import jalview.gui.StructureViewer.ViewerType;
import jalview.gui.StructureViewerBase;
import jalview.gui.TreePanel;
+import jalview.io.BackupFiles;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.io.NewickFile;
public void saveState(File statefile)
{
FileOutputStream fos = null;
+
try
{
+
fos = new FileOutputStream(statefile);
+
JarOutputStream jout = new JarOutputStream(fos);
saveState(jout);
+ fos.close();
} catch (Exception 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)
{
- errorMessage = "Couldn't write Jalview Archive to output file '"
+ errorMessage = "Did't write Jalview Archive to output file '"
+ statefile + "' - See console error log for details";
}
else
{
- errorMessage += "(output file was '" + statefile + "')";
+ errorMessage += "(Didn't write Jalview Archive to output file '"
+ + statefile + ")";
}
e.printStackTrace();
} finally
{
try
{
- FileOutputStream fos = new FileOutputStream(jarFile);
+ // create backupfiles object and get new temp filename destination
+ BackupFiles backupfiles = new BackupFiles(jarFile);
+ FileOutputStream fos = new FileOutputStream(
+ backupfiles.getTempFilePath());
+
JarOutputStream jout = new JarOutputStream(fos);
List<AlignFrame> frames = new ArrayList<>();
}
;
jout.close();
- return true;
+ boolean success = true;
+
+ backupfiles.setWriteSuccess(success);
+ success = backupfiles.rollBackupsAndRenameTempFile();
+
+ return success;
} catch (Exception ex)
{
errorMessage = "Couldn't Write alignment view to Jalview Archive - see error output for details";
ex.printStackTrace(System.err);
if (attemptversion1parse)
{
- // Is Version 1 Jar file?
- try
- {
- af = new Jalview2XML_V1(raiseGUI).LoadJalviewAlign(jprovider);
- } catch (Exception ex2)
- {
- System.err.println("Exception whilst loading as jalviewXMLV1:");
- ex2.printStackTrace();
- af = null;
- }
+ // used to attempt to parse as V1 castor-generated xml
}
if (Desktop.instance != null)
{
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)
{
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();