JAL-1911 further improvement to bugfix - do not save i18n text in preference file
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 27 May 2016 10:15:32 +0000 (11:15 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 27 May 2016 10:15:32 +0000 (11:15 +0100)
src/jalview/gui/Preferences.java

index 84baa1c..117f103 100755 (executable)
@@ -164,6 +164,16 @@ public class Preferences extends GPreferences
 
   private WsPreferences wsPrefs;
 
+  private OptionsParam promptEachTimeOpt = new OptionsParam(
+          MessageManager.getString("label.prompt_each_time"),
+          "Prompt each time");
+
+  private OptionsParam lineArtOpt = new OptionsParam(
+          MessageManager.getString("label.lineart"), "Lineart");
+
+  private OptionsParam textOpt = new OptionsParam(
+          MessageManager.getString("action.text"), "Text");
+
   /**
    * Creates a new Preferences object.
    */
@@ -359,23 +369,19 @@ public class Preferences extends GPreferences
     /*
      * Set Output tab defaults
      */
-    epsRendering.addItem(new OptionsParam(MessageManager
-            .getString("label.prompt_each_time"), "Prompt each time"));
-    epsRendering.addItem(new OptionsParam(MessageManager
-            .getString("label.lineart"), "Lineart"));
-    epsRendering.addItem(new OptionsParam(MessageManager
-            .getString("action.text"), "Text"));
+
+    epsRendering.addItem(promptEachTimeOpt);
+    epsRendering.addItem(lineArtOpt);
+    epsRendering.addItem(textOpt);
     String defaultEPS = Cache.getDefault("EPS_RENDERING",
             "Prompt each time");
     if (defaultEPS.equalsIgnoreCase("Text"))
     {
-      epsRendering.setSelectedItem(new OptionsParam(MessageManager
-              .getString("action.text"), "Text"));
+      epsRendering.setSelectedItem(textOpt);
     }
     else if (defaultEPS.equalsIgnoreCase("Lineart"))
     {
-      epsRendering.setSelectedItem(new OptionsParam(MessageManager
-              .getString("label.lineart"), "Lineart"));
+      epsRendering.setSelectedItem(lineArtOpt);
     }
     else
     {
@@ -532,15 +538,8 @@ public class Preferences extends GPreferences
     /*
      * Save Output settings
      */
-    if (epsRendering.getSelectedItem().equals("Prompt each time"))
-    {
-      Cache.applicationProperties.remove("EPS_RENDERING");
-    }
-    else
-    {
       Cache.applicationProperties.setProperty("EPS_RENDERING",
               ((OptionsParam) epsRendering.getSelectedItem()).getCode());
-    }
 
     /*
      * Save Connections settings