Removed usage of deprecated Prefs.NODE public member variable. This is to prepare...
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Mon, 12 Dec 2011 21:54:32 +0000 (21:54 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Mon, 12 Dec 2011 21:54:32 +0000 (21:54 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@219 180e2498-e6e9-4542-8430-84ac67f01cd8

src/net/sf/openrocket/gui/dialogs/preferences/PreferencesDialog.java
src/net/sf/openrocket/gui/main/ComponentAddButtons.java
src/net/sf/openrocket/gui/main/RocketActions.java
src/net/sf/openrocket/gui/main/SimulationEditDialog.java
src/net/sf/openrocket/gui/main/SimulationPanel.java
src/net/sf/openrocket/util/Prefs.java

index 4c3f0fd6f2ca1e9e3923786fc67239d1c8b69e9f..d4956e2d78c3281ac2a45001c0fc25825857b876 100644 (file)
@@ -542,7 +542,7 @@ public class PreferencesDialog extends JDialog {
                
                @Override
                public Object getSelectedItem() {
-                       if (Prefs.NODE.getBoolean(preference, def)) {
+                       if (Prefs.getBoolean(preference, def)) {
                                return trueDesc;
                        } else {
                                return falseDesc;
@@ -560,9 +560,9 @@ public class PreferencesDialog extends JDialog {
                        }
                        
                        if (trueDesc.equals(item)) {
-                               Prefs.NODE.putBoolean(preference, true);
+                               Prefs.putBoolean(preference, true);
                        } else if (falseDesc.equals(item)) {
-                               Prefs.NODE.putBoolean(preference, false);
+                               Prefs.putBoolean(preference, false);
                        } else {
                                throw new IllegalArgumentException("Illegal argument " + item);
                        }
index a5bdb789b9b9096102bb0159ec0ab6a2e8037889..7061e34c255a3480f55c8e879c5024d69b62b8c3 100644 (file)
@@ -578,7 +578,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
                        
                        if (check.isSelected()) {
                                // Save the preference
-                               Prefs.NODE.putInt(Prefs.BODY_COMPONENT_INSERT_POSITION_KEY, sel);
+                               Prefs.putInt(Prefs.BODY_COMPONENT_INSERT_POSITION_KEY, sel);
                        }
                        return sel;
                }
index 4bd754a93319f92b58ec1b47d0bc29a8f4f65542..b5265dc175c190875d358163d8bae5bfaee6cc35 100644 (file)
@@ -207,7 +207,7 @@ public class RocketActions {
        
        
        private boolean verifyDeleteSimulation() {
-               boolean verify = Prefs.NODE.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
+               boolean verify = Prefs.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
                if (verify) {
                        JPanel panel = new JPanel(new MigLayout());
                        //// Do not ask me again
@@ -233,7 +233,7 @@ public class RocketActions {
                                return false;
 
                        if (dontAsk.isSelected()) {
-                               Prefs.NODE.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
+                               Prefs.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
                        }
                }
 
index 39b5fbea2e934e3ae1c688a3e4a1ba51a3cd14a9..3a8cd623d1edbb9e4660827f2c008c4de821ea93 100644 (file)
@@ -741,7 +741,7 @@ public class SimulationEditDialog extends JDialog {
                button.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
-                               String previous = Prefs.NODE.get("previousListenerName", "");
+                               String previous = Prefs.getString("previousListenerName", "");
                                String input = (String) JOptionPane.showInputDialog(SimulationEditDialog.this,
                                                new Object[] {
                                                                //// Type the full Java class name of the simulation listener, for example:
@@ -756,7 +756,7 @@ public class SimulationEditDialog extends JDialog {
                                if (input == null || input.equals(""))
                                        return;
                                
-                               Prefs.NODE.put("previousListenerName", input);
+                               Prefs.putString("previousListenerName", input);
                                simulation.getSimulationListeners().add(input);
                                listenerModel.fireContentsChanged();
                        }
index 36b5a608d116e47d203b6b7011dfbfa0c65c1b4c..a2cc858e22945e434479a94d45d718dc847e1ebe 100644 (file)
@@ -154,7 +154,7 @@ public class SimulationPanel extends JPanel {
                                        return; // TODO: LOW: "None selected" dialog
                                        
                                // Verify deletion
-                               boolean verify = Prefs.NODE.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
+                               boolean verify = Prefs.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
                                if (verify) {
                                        
                                        JPanel panel = new JPanel(new MigLayout());
@@ -180,7 +180,7 @@ public class SimulationPanel extends JPanel {
                                                return;
                                        
                                        if (dontAsk.isSelected()) {
-                                               Prefs.NODE.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
+                                               Prefs.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
                                        }
                                }
                                
index 88822fa79509b2517164486c0f32ccb047603ccb..75459e2b26f713cabdaaa8b8b3e187a96022c3e1 100644 (file)
@@ -158,12 +158,6 @@ public class Prefs {
        public static final String PREFERRED_THRUST_CURVE_MOTOR_NODE = "preferredThrustCurveMotors";
        
 
-       /**
-        * Node to this application's preferences.
-        * @deprecated  Use the static methods instead.
-        */
-       @Deprecated
-       public static final Preferences NODE;
        private static final Preferences PREFNODE;
        
 
@@ -180,7 +174,6 @@ public class Prefs {
                        }
                }
                PREFNODE = root.node(NODENAME);
-               NODE = PREFNODE;
        }
        
 
@@ -388,7 +381,14 @@ public class Prefs {
                storeVersion();
        }
        
+       public static int getInt( String key, int defaultValue ) {
+               return PREFNODE.getInt(key, defaultValue);
+       }
        
+       public static void putInt( String key , int value ) {
+               PREFNODE.putInt(key, value );
+       }
+
        /**
         * Return a preferences object for the specified node name.
         * 
@@ -595,11 +595,6 @@ public class Prefs {
                return 0.3;
        }
        
-       public static int getInt( String key, int defaultValue ) {
-               return PREFNODE.getInt(key, defaultValue);
-       }
-
-
        public static Material getDefaultComponentMaterial(
                        Class<? extends RocketComponent> componentClass,
                        Material.Type type) {