Removed usage of deprecated Prefs.NODE public member variable. This is to prepare for Preference refactoring.

This commit is contained in:
Kevin Ruland 2011-12-12 21:54:32 +00:00
parent 50feb2c612
commit 8e70a87e5d
6 changed files with 17 additions and 22 deletions

View 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);
}

View 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;
}

View 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);
}
}

View 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();
}

View 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);
}
}

View 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,6 +381,13 @@ 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) {