label.default = Defecto
label.single_file = Solo uno respaldo
label.keep_all_versions = Mantener todas las versiones
-label.rolled_backups = Ciclos resaldos
+label.rolled_backups = Ciclos respaldos
label.previously_saved_scheme = Esquema previamente guardado
label.no_backup_files = NO ARCHIVOS DE RESPALDOS
label.include_backup_files = Incluir archivos de respaldos
-label.cancel_changes = Cancelar cambios
\ No newline at end of file
+label.cancel_changes = Cancelar cambios
+label.warning_confirm_change_reverse = ¡Advertencia!\nSi cambia el incremento/decremento del número de archivos de respaldos, sin cambiar el sufijo o los dígitos,\nesto puede causar la pérdida de los archivos de respaldos creados con el esquema anterior de nombre de archivo de respaldos.\n¿Está seguro de que desea hacer esto?
+label.change_increment_decrement = ¿Cambiar de incremento/decremento?
\ No newline at end of file
boolean delete = false;
if (confirmDelete)
{
- // Object[] confirmMessageArray = {};
StringBuilder confirmMessage = new StringBuilder();
confirmMessage.append(MessageManager
.getString("label.backupfiles_confirm_delete_old_files"));
}
}
- private TreeMap sortBackupFilesAsTreeMap(File[] backupFiles,
+ private TreeMap<Integer, File> sortBackupFilesAsTreeMap(
+ File[] backupFiles,
String basename)
{
// sort the backup files (based on integer found in the suffix) using a
File file = new File(fileName);
- String dir = "";
File dirFile;
try
{
dirFile = file.getParentFile();
- dir = dirFile.getCanonicalPath();
} catch (Exception e)
{
System.out.println(
import jalview.fts.core.FTSDataColumnPreferences;
import jalview.fts.core.FTSDataColumnPreferences.PreferenceSource;
import jalview.fts.service.pdb.PDBFTSRestClient;
+import jalview.gui.Desktop;
import jalview.gui.JalviewBooleanRadioButtons;
+import jalview.gui.JvOptionPane;
import jalview.gui.JvSwingUtils;
import jalview.gui.StructureViewer.ViewerType;
import jalview.io.BackupFilenameParts;
updateBackupFilesExampleLabel();
}
+ private boolean warnAboutSuffixReverseChange()
+ {
+ boolean savedSuffixReverse = Cache.getDefault(BackupFiles.REVERSE_ORDER,
+ false);
+ int savedSuffixDigits = Cache.getDefault(BackupFiles.SUFFIX_DIGITS, 3);
+ String savedSuffixTemplate = Cache.getDefault(BackupFiles.SUFFIX,
+ ".bak" + BackupFiles.NUM_PLACEHOLDER);
+
+ boolean nowSuffixReverse = suffixReverse.isSelected();
+ int nowSuffixDigits = getSpinnerInt(suffixDigitsSpinner, 3);
+ String nowSuffixTemplate = suffixTemplate.getText();
+ return nowSuffixReverse != savedSuffixReverse
+ && nowSuffixDigits == savedSuffixDigits
+ && nowSuffixTemplate != null
+ && nowSuffixTemplate.equals(savedSuffixTemplate);
+ }
+
/**
* Initialises the Backups tabbed panel.
*
@Override
public void actionPerformed(ActionEvent e)
{
- updateBackupFilesExampleLabel();
+ boolean okay = true;
+ if (warnAboutSuffixReverseChange())
+ {
+ // Warning popup
+ okay = confirmSuffixReverseChange();
+ }
+ if (okay)
+ {
+ updateBackupFilesExampleLabel();
+ }
+ else
+ {
+ boolean savedSuffixReverse = Cache
+ .getDefault(BackupFiles.REVERSE_ORDER, false);
+ suffixReverse.setSelected(savedSuffixReverse);
+ }
}
});
return suffixPanel;
}
+ private boolean confirmSuffixReverseChange()
+ {
+ boolean ret = false;
+ String warningMessage = MessageManager
+ .getString("label.warning_confirm_change_reverse");
+ int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop,
+ warningMessage,
+ MessageManager.getString("label.change_increment_decrement"),
+ JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
+
+ ret = (confirm == JvOptionPane.YES_OPTION);
+ return ret;
+ }
+
private JPanel initBackupsTabKeepFilesPanel()
{
keepfilesPanel.setBorder(
return;
}
- try
- {
- backupfilesRollMaxSpinner.commitEdit();
- rollMax = (Integer) backupfilesRollMaxSpinner.getValue();
- rollMax = rollMax < 1 ? 1 : rollMax;
- } catch (Exception e)
- {
- System.out.println(
- "Failed casting (Integer) backupfilesRollMaxSpinner.getValue()");
- }
+ rollMax = getSpinnerInt(backupfilesRollMaxSpinner, 4);
+ rollMax = rollMax < 1 ? 1 : rollMax;
if (suffix.indexOf(BackupFiles.NUM_PLACEHOLDER) == -1)
{
rollMax = 1;
}
- try
- {
- suffixDigitsSpinner.commitEdit();
- digits = (Integer) suffixDigitsSpinner.getValue();
- digits = digits < 1 ? 1 : digits;
- } catch (Exception e)
- {
- System.out.println(
- "Failed casting (Integer) suffixTemplateSpinner.getValue()");
- }
+ digits = getSpinnerInt(suffixDigitsSpinner, 3);
+ digits = digits < 1 ? 1 : digits;
int lowersurround = 2;
int uppersurround = 0;