JAL-3210 Barebones gradle/buildship/eclipse. See README
[jalview.git] / src / jalview / gui / Preferences.java
index f961712..94f67f6 100755 (executable)
@@ -25,6 +25,7 @@ import jalview.bin.Cache;
 import jalview.gui.Help.HelpId;
 import jalview.gui.StructureViewer.ViewerType;
 import jalview.io.BackupFiles;
+import jalview.io.BackupFilesPresetEntry;
 import jalview.io.FileFormatI;
 import jalview.io.JalviewFileChooser;
 import jalview.io.JalviewFileView;
@@ -193,7 +194,7 @@ public class Preferences extends GPreferences
     /**
      * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
     {
       wsPrefs = new WsPreferences();
@@ -546,7 +547,10 @@ public class Preferences extends GPreferences
     /*
      * Set Backups tab defaults
      */
-    loadLastSavedBackupsOptions();
+    if (!Platform.isJS())
+    {
+      loadLastSavedBackupsOptions();
+    }
   }
 
   /**
@@ -839,22 +843,29 @@ public class Preferences extends GPreferences
     /*
      * Save Backups settings
      */
-    Cache.applicationProperties.setProperty(BackupFiles.CONFIRM_DELETE_OLD,
-            Boolean.toString(backupfilesConfirmDelete.isSelected()));
     Cache.applicationProperties.setProperty(BackupFiles.ENABLED,
-            Boolean.toString(enableBackupFiles.isSelected()));
-    Cache.applicationProperties.setProperty(BackupFiles.NO_MAX,
-            Boolean.toString(backupfilesKeepAll.isSelected()));
-    Cache.applicationProperties.setProperty(BackupFiles.REVERSE_ORDER,
-            Boolean.toString(suffixReverse.isSelected()));
-    Cache.applicationProperties.setProperty(BackupFiles.SUFFIX,
-            suffixTemplate.getText());
-    Cache.applicationProperties.setProperty(BackupFiles.ROLL_MAX,
-            Integer.toString(getSpinnerInt(backupfilesRollMaxSpinner, 4)));
-    Cache.applicationProperties.setProperty(BackupFiles.SUFFIX_DIGITS,
-            Integer.toString(getSpinnerInt(suffixDigitsSpinner, 3)));
-    Cache.applicationProperties.setProperty(BackupFiles.NS+"_PRESET",
-            Integer.toString(getComboIntStringKey(backupfilesPresetsCombo)));
+            Platform.isJS() ? Boolean.FALSE.toString()
+                    : Boolean.toString(enableBackupFiles.isSelected()));
+    if (!Platform.isJS())
+    {
+      int preset = getComboIntStringKey(backupfilesPresetsCombo);
+      Cache.applicationProperties.setProperty(BackupFiles.NS + "_PRESET",
+              Integer.toString(preset));
+
+      if (preset == BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM)
+      {
+        BackupFilesPresetEntry customBFPE = getBackupfilesCurrentEntry();
+        BackupFilesPresetEntry.backupfilesPresetEntriesValues.put(
+                BackupFilesPresetEntry.BACKUPFILESSCHEMECUSTOM, customBFPE);
+        Cache.applicationProperties.setProperty(
+                BackupFilesPresetEntry.CUSTOMCONFIG, customBFPE.toString());
+      }
+
+      BackupFilesPresetEntry savedBFPE = BackupFilesPresetEntry.backupfilesPresetEntriesValues
+              .get(preset);
+      Cache.applicationProperties.setProperty(
+              BackupFilesPresetEntry.SAVEDCONFIG, savedBFPE.toString());
+    }
 
     Cache.saveProperties();
     Desktop.instance.doConfigureStructurePrefs();
@@ -1077,7 +1088,7 @@ public class Preferences extends GPreferences
     /**
      * Java only
      * 
-     * @j2sNative
+     * @j2sIgnore
      */
     {
       JFileChooser chooser = new JFileChooser(".");