From: Ben Soares Date: Tue, 7 Jul 2020 00:30:23 +0000 (+0100) Subject: JAL-3628 Fixed oddly worded and non-formatted error popups when saving fails X-Git-Tag: Develop-2_11_2_0-d20201215~15^2~29 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=71741581d76a664856fdd270e3738307e0a4ecf9;p=jalview.git JAL-3628 Fixed oddly worded and non-formatted error popups when saving fails --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 1a6a367..e65bf61 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -372,7 +372,7 @@ label.example = Example label.example_param = Example: {0} label.select_file_format_before_saving = You must select a file format before saving! label.file_format_not_specified = File format not specified -label.couldnt_save_file = Couldn't save file: {0} +label.couldnt_save_file = Couldn''t save file: {0} label.error_saving_file = Error Saving File label.remove_from_default_list = Remove from default list? label.remove_user_defined_colour = Remove user defined colour @@ -1312,6 +1312,7 @@ 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. label.backupfiles_confirm_save_new_saved_file_ok = The new saved file seems okay. label.backupfiles_confirm_save_new_saved_file_not_ok = The new saved file might not be okay. +label.continue_operation = Continue operation? label.backups = Backups label.backup = Backup label.backup_files = Backup Files diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index 7e5c5a5..658abff 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1313,6 +1313,7 @@ label.backupfiles_confirm_save_file = Confirmar guardar archivo label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Posiblemente algo está mal con los archivos de respaldos. label.backupfiles_confirm_save_new_saved_file_ok = El nuevo archivo guardado parece estar bien. label.backupfiles_confirm_save_new_saved_file_not_ok = El nuevo archivo guardado podría no estar bien. +label.continue_operation = ¿Continuar operación? label.backups = Respaldos label.backup = Respaldo label.backup_files = Archivos de respaldos diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 9658abf..4da30ea 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1250,7 +1250,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, statusBar.setText(MessageManager.formatMessage( "label.successfully_saved_to_file_in_format", new Object[] - { fileName, format })); + { file, format })); return; } @@ -1321,14 +1321,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Cache.log.error( "ALIGNFRAME Something happened writing the temp file"); Cache.log.error(e.getMessage()); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); } catch (Exception ex) { lastSaveSuccessful = false; Cache.log.error( "ALIGNFRAME Something else happened writing the temp file"); Cache.log.error(ex.getMessage()); - Cache.log.debug(ex.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(ex)); } if (doBackup) diff --git a/src/jalview/io/BackupFiles.java b/src/jalview/io/BackupFiles.java index 11d1a16..7567a81 100644 --- a/src/jalview/io/BackupFiles.java +++ b/src/jalview/io/BackupFiles.java @@ -152,11 +152,11 @@ public class BackupFiles Cache.log .error("Could not create temp file to save to (IOException)"); Cache.log.error(e.getMessage()); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); } catch (Exception e) { Cache.log.error("Exception creating temp file for saving"); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); } this.setTempFile(temp); } @@ -218,7 +218,7 @@ public class BackupFiles Cache.log.error( "IOException when getting Canonical Path of temp file '" + this.getTempFile().getName() + "'"); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); } return path; } @@ -276,7 +276,7 @@ public class BackupFiles Cache.log.error( "Could not get canonical path for file '" + file + "'"); Cache.log.error(e.getMessage()); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); return false; } String filename = file.getName(); @@ -416,7 +416,7 @@ public class BackupFiles Cache.log.error( "Error occurred, probably making new temp file for '" + fileToBeDeleted.getName() + "'"); - Cache.log.error(e.getStackTrace()); + Cache.log.error(Cache.getStackTraceString(e)); } // reset @@ -800,6 +800,12 @@ public class BackupFiles "label.backupfiles_confirm_save_new_saved_file_not_ok")); // "The new saved file might not be okay." } + if (messageSB.length() > 0) + { + messageSB.append("\n"); + } + messageSB + .append(MessageManager.getString("label.continue_operation")); int confirmButton = Platform.isHeadless() ? JvOptionPane.OK_OPTION : JvOptionPane.showConfirmDialog(Desktop.desktop, @@ -907,12 +913,12 @@ public class BackupFiles Cache.log.warn("Could not move file '" + oldPath.toString() + "' to '" + newPath.toString() + "'"); Cache.log.error(e.getMessage()); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); ret = false; } catch (Exception e) { Cache.log.error(e.getMessage()); - Cache.log.debug(e.getStackTrace()); + Cache.log.debug(Cache.getStackTraceString(e)); ret = false; } return ret;