From 0e225b1a7289824534da493c7da191d515dd6c29 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 24 May 2019 17:35:41 +0100 Subject: [PATCH] JAL-3141 Fixes recommended from gmc's test --- resources/lang/Messages.properties | 1 + resources/lang/Messages_es.properties | 1 + src/jalview/io/IntKeyStringValueEntry.java | 14 ++----------- src/jalview/jbgui/GPreferences.java | 31 +++++++--------------------- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 345d9a7..6bcdf4b 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1354,6 +1354,7 @@ label.append_to_filename = Append to filename (%n is replaced by the backup numb label.append_to_filename_tooltip = %n in the text will be replaced by the backup number. The text will appear after the filename. See the summary box above. label.index_digits = Number of digits to use for the backup number (%n) label.summary_of_backups_scheme = Summary of backup scheme +label.scheme_examples = Scheme examples label.increment_index = Increase appended text numbers - newest file has largest number. label.reverse_roll = "Roll" appended text numbers - newest backup file is always number 1. label.keep_files = Deleting old backup files diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index b6a0c12..a14efe5 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1355,6 +1355,7 @@ label.append_to_filename = Adjuntar texto (%n es reemplazado por el n label.append_to_filename_tooltip = %n en el texto será reemplazado por el número de respaldo. El texto será después del nombre del archivo. Vea el cuadro de resumen arriba. label.index_digits = Número de dígitos a utilizar para el número de respaldo. label.summary_of_backups_scheme = Resumen del esquema de copias de seguridad +label.scheme_examples = Ejemplos de esquema label.increment_index = Aumente los números de texto adjuntos: el archivo más nuevo tiene el número más grande label.reverse_roll = Ciclos de texto adjuntos: el respaldo más reciente es siempre el número 1 label.keep_files = Borrando los respaldos antiguos diff --git a/src/jalview/io/IntKeyStringValueEntry.java b/src/jalview/io/IntKeyStringValueEntry.java index f246ad2..084dbc5 100644 --- a/src/jalview/io/IntKeyStringValueEntry.java +++ b/src/jalview/io/IntKeyStringValueEntry.java @@ -2,9 +2,9 @@ package jalview.io; public class IntKeyStringValueEntry { - public int k; + public final int k; - public String v; + public final String v; public IntKeyStringValueEntry(int k, String v) { @@ -15,16 +15,6 @@ public class IntKeyStringValueEntry @Override public String toString() { - return this.getValue(); - } - - public int getKey() - { - return k; - } - - public String getValue() - { return v; } diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 5685e84..7a4d99a 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -1720,27 +1720,13 @@ public class GPreferences extends JPanel setComboIntStringKey(backupfilesPresetsCombo, Cache.getDefault(BackupFiles.NS + "_PRESET", BackupFilesPresetEntry.BACKUPFILESSCHEMEDEFAULT)); - // backupsTabUpdatePresets(); - System.out - .println("LOADLASTSAVEDBACKUPSOPTIONS SETTING BACKUPS OPTIONS"); backupsSetOptions(savedPreset); backupsOptionsSetEnabled(); updateBackupFilesExampleLabel(); } - private void setBackupfilesCustomPreset() - { - if (customiseCheckbox.isSelected() && getComboIntStringKey( - backupfilesPresetsCombo) == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM) - { - BackupFilesPresetEntry.backupfilesPresetEntriesValues - .put(BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, - getBackupfilesCurrentEntry()); - } - } - private boolean warnAboutSuffixReverseChange() { BackupFilesPresetEntry bfpe = BackupFilesPresetEntry @@ -1963,7 +1949,7 @@ public class GPreferences extends JPanel private JPanel initBackupsTabFilenameExamplesPanel() { String title = MessageManager - .getString("label.summary_of_backups_scheme"); + .getString("label.scheme_examples"); TitledBorder tb = new TitledBorder(title); exampleFilesPanel.setBorder(tb); exampleFilesPanel.setLayout(new GridBagLayout()); @@ -1989,8 +1975,8 @@ public class GPreferences extends JPanel { IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo .getSelectedItem(); - int key = entry.getKey(); - String value = entry.getValue(); + int key = entry.k; + String value = entry.v; if (BackupFilesPresetEntry.backupfilesPresetEntriesValues .containsKey(key)) @@ -2001,7 +1987,7 @@ public class GPreferences extends JPanel } else { - System.out.println( + Cache.log.error( "Preset '" + value + "' [key:" + key + "] not implemented"); } @@ -2014,7 +2000,7 @@ public class GPreferences extends JPanel protected int getComboIntStringKey(JComboBox c) { IntKeyStringValueEntry e = (IntKeyStringValueEntry) c.getSelectedItem(); - return e != null ? e.getKey() : 0; + return e != null ? e.k : 0; } protected void setComboIntStringKey(JComboBox c, @@ -2023,7 +2009,7 @@ public class GPreferences extends JPanel for (int i = 0; i < c.getItemCount(); i++) { IntKeyStringValueEntry e = c.getItemAt(i); - if (e.getKey() == key) + if (e.k == key) { c.setSelectedIndex(i); break; @@ -2076,7 +2062,6 @@ public class GPreferences extends JPanel @Override public void keyTyped(KeyEvent e) { - int count = 300; char c = e.getKeyChar(); if (c == ':' || c == '/' || c == '\\') { @@ -2468,7 +2453,7 @@ public class GPreferences extends JPanel i = Integer.parseInt((String) s.getValue()); } catch (Exception e) { - System.out.println( + Cache.log.error( "Exception casting the initial value of s.getValue()"); } } @@ -2500,7 +2485,7 @@ public class GPreferences extends JPanel i = (Integer) s.getValue(); } catch (Exception e) { - System.out.println("Failed casting (Integer) JSpinner s.getValue()"); + Cache.log.error("Failed casting (Integer) JSpinner s.getValue()"); } return i; } -- 1.7.10.2