JAL-3063 switched from castor to JAXB - backupFile bits added to jalview.project.Jalview2XML
label.most_polymer_residues = Most Polymer Residues
label.cached_structures = Cached Structures
label.free_text_search = Free Text Search
+label.backupfiles_confirm_delete = Confirm delete
+label.backupfiles_confirm_delete_old_files = Delete the following older backup files? (see the Backups tab in Preferences for more options)
+label.backupfiles_confirm_save_file = Confirm save file
+label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Something possibly went wrong with the backups of this file, write the new file anyway?
+label.backups = Backups
+label.backup_files = Backup Files
+label.enable_backupfiles = Enable backup files
+label.suffix_format = Suffix format
+label.suffix_template = Suffix template (use %n to represent the backup/version index)
+label.suffix_template_tooltip = %n in the template will be replaced by the index number. The suffix will appear before the filename extension.
+label.index_digits = Number of digits to use for the index
+label.example_filenames = Example filenames
+label.increment_index = Increment suffix indexes (like version files) - newest file has largest index.
+label.reverse_roll = Reverse and "roll" suffix indexes (like log files) - newest file is always index 1.
+label.keep_files = Keep Files
+label.keep_all_backup_files = Keep all backup files
+label.keep_only_this_number_of_backup_files = Keep only this number of most recent backup files
+label.old_backup_files = Old backup files:
+label.confirm_delete = Confirm deletions
+label.auto_delete = Automatically delete
+label.filename = filename
+label.braced_oldest = (oldest)
+label.braced_newest = (most recent)
+ label.configuration = Configuration
+ label.configure_feature_tooltip = Click to configure variable colour or filters
label.most_polymer_residues = Más Residuos de Polímeros
label.cached_structures = Estructuras en Caché
label.free_text_search = Búsqueda de texto libre
+# dodgy tranlations by Ben and Google translate -- probably could do better
+label.backupfiles_confirm_delete = Confirmar borrar
+label.backupfiles_confirm_delete_old_files = ¿Borrar los siguientes archivos? (ver la pestaña 'Copias' de la ventana de Preferencias para más opciones)
+label.backupfiles_confirm_save_file = Confirmar guardar archivo
+label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Posiblemente algo está mal con los archivos de copia de seguridad. ¿Guardar el nuevo archivo?
+label.backups = Copias
+label.backup_files = Copias de seguridad
+label.enable_backupfiles = Habilitar copias de seguridad
+label.suffix_format = Formato de sufijo
+label.suffix_template = Plantilla de sufijo (usa %n para representar el índice)
+label.suffix_template_tooltip = Esto será reemplazado por el número de índice. El sufijo aparecerá antes de la extensión.
+label.index_digits = Número de dígitos a utilizar para el índice.
+label.example_filenames = Ejemplos de nombres de archivos
+label.increment_index = El archivo más nuevo tiene el índice más grande
+label.reverse_roll = El archivo más nuevo tiene índice 1
+label.keep_files = Manten los archivos
+label.keep_all_backup_files = Mantener todos los archivos de copia de seguridad
+label.keep_only_this_number_of_backup_files = Mantenga solo este número de archivos de copia de seguridad más recientes
+label.old_backup_files = Viejos archivos de copia de seguridad:
+label.confirm_delete = Confirmar eliminaciones
+label.auto_delete = Eliminar automáticamente
+label.filename = nombre_de_archivo
+label.braced_oldest = (mas antiguo)
+label.braced_newest = (mas nuevo)
+ label.configuration = Configuración
+ label.configure_feature_tooltip = Haga clic para configurar el color o los filtros
}
/**
- * DOCUMENT ME!
- *
- * @param e
- * DOCUMENT ME!
+ * Shows a file chooser dialog and writes out the current session as a Jalview
+ * project file
*/
@Override
- public void saveState_actionPerformed(ActionEvent e)
+ public void saveState_actionPerformed()
{
- saveState_actionPerformed(e, false);
- JalviewFileChooser chooser = new JalviewFileChooser("jvp",
- "Jalview Project");
++ saveState_actionPerformed(false);
+ }
- public void saveState_actionPerformed(ActionEvent e, boolean saveAs)
- chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle(MessageManager.getString("label.save_state"));
++ public void saveState_actionPerformed(boolean saveAs)
+ {
+ java.io.File projectFile = getProjectFile();
+ // autoSave indicates we already have a file and don't need to ask
+ boolean autoSave = projectFile != null && !saveAs && BackupFiles.getEnabled();
- int value = chooser.showSaveDialog(this);
+ System.out.println("autoSave="+autoSave+", projectFile='"+projectFile+"', saveAs="+saveAs+", Backups "+(BackupFiles.getEnabled()?"enabled":"disabled"));
- if (value == JalviewFileChooser.APPROVE_OPTION)
+ boolean approveSave = false;
+ if (!autoSave)
{
- final Desktop me = this;
- final java.io.File choice = chooser.getSelectedFile();
- setProjectFile(choice);
+ JalviewFileChooser chooser = new JalviewFileChooser("jvp",
+ "Jalview Project");
+
+ chooser.setFileView(new JalviewFileView());
+ chooser.setDialogTitle(MessageManager.getString("label.save_state"));
+
+ int value = chooser.showSaveDialog(this);
+ if (value == JalviewFileChooser.APPROVE_OPTION)
+ {
+ projectFile = chooser.getSelectedFile();
+ setProjectFile(projectFile);
+ approveSave = true;
+ }
+ }
+
+ if (approveSave || autoSave) {
+ final Desktop me = this;
+ final java.io.File chosenFile = projectFile;
new Thread(new Runnable()
{
@Override
}
}
+ @Override
+ public void saveAsState_actionPerformed(ActionEvent e)
+ {
- saveState_actionPerformed(e, true);
++ saveState_actionPerformed(true);
+ }
+
private void setProjectFile(File choice)
{
this.projectFile = choice;
@Override
public void actionPerformed(ActionEvent e)
{
- saveState_actionPerformed(e);
+ saveState_actionPerformed();
}
});
+ saveAsState.setText(MessageManager.getString("action.save_project_as"));
+ saveAsState.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ saveAsState_actionPerformed(e);
+ }
+ });
loadState.setText(MessageManager.getString("action.load_project"));
loadState.addActionListener(new ActionListener()
{
{
}
+ public void saveAsState_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e
+ * DOCUMENT ME!
+ */
- public void loadState_actionPerformed(ActionEvent e)
+ public void loadState_actionPerformed()
{
}
import jalview.datamodel.features.FeatureMatcherSet;
import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.ext.varna.RnaModel;
+ import jalview.gui.AlignFrame;
+ import jalview.gui.AlignViewport;
+ import jalview.gui.AlignmentPanel;
+ import jalview.gui.AppVarna;
+ import jalview.gui.ChimeraViewFrame;
+ import jalview.gui.Desktop;
+ import jalview.gui.FeatureRenderer;
+ import jalview.gui.JvOptionPane;
+ import jalview.gui.OOMWarning;
+ import jalview.gui.PCAPanel;
+ import jalview.gui.PaintRefresher;
+ import jalview.gui.SplitFrame;
+ import jalview.gui.StructureViewer;
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;
+ import jalview.math.Matrix;
+ import jalview.math.MatrixI;
import jalview.renderer.ResidueShaderI;
- import jalview.schemabinding.version2.AlcodMap;
- import jalview.schemabinding.version2.AlcodonFrame;
- import jalview.schemabinding.version2.Annotation;
- import jalview.schemabinding.version2.AnnotationColours;
- import jalview.schemabinding.version2.AnnotationElement;
- import jalview.schemabinding.version2.CalcIdParam;
- import jalview.schemabinding.version2.CompoundMatcher;
- import jalview.schemabinding.version2.DBRef;
- import jalview.schemabinding.version2.Features;
- import jalview.schemabinding.version2.Group;
- import jalview.schemabinding.version2.HiddenColumns;
- import jalview.schemabinding.version2.JGroup;
- import jalview.schemabinding.version2.JSeq;
- import jalview.schemabinding.version2.JalviewModel;
- import jalview.schemabinding.version2.JalviewModelSequence;
- import jalview.schemabinding.version2.MapListFrom;
- import jalview.schemabinding.version2.MapListTo;
- import jalview.schemabinding.version2.Mapping;
- import jalview.schemabinding.version2.MappingChoice;
- import jalview.schemabinding.version2.MatchCondition;
- import jalview.schemabinding.version2.MatcherSet;
- import jalview.schemabinding.version2.OtherData;
- import jalview.schemabinding.version2.PdbentryItem;
- import jalview.schemabinding.version2.Pdbids;
- import jalview.schemabinding.version2.Property;
- import jalview.schemabinding.version2.RnaViewer;
- import jalview.schemabinding.version2.SecondaryStructure;
- import jalview.schemabinding.version2.Sequence;
- import jalview.schemabinding.version2.SequenceSet;
- import jalview.schemabinding.version2.SequenceSetProperties;
- import jalview.schemabinding.version2.Setting;
- import jalview.schemabinding.version2.StructureState;
- import jalview.schemabinding.version2.ThresholdLine;
- import jalview.schemabinding.version2.Tree;
- import jalview.schemabinding.version2.UserColours;
- import jalview.schemabinding.version2.Viewport;
- import jalview.schemabinding.version2.types.ColourThreshTypeType;
- import jalview.schemabinding.version2.types.FeatureMatcherByType;
- import jalview.schemabinding.version2.types.NoValueColour;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
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(statefile);
+
- fos = new FileOutputStream(statefile);
++ fos = new FileOutputStream(backupfiles.getTempFilePath());
+
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);
// 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 + "\nTemporary file is at: "
++ + backupfiles.getTempFile() + ")";
}
e.printStackTrace();
} finally