Removed usage of deprecated Prefs.NODE public member variable. This is to prepare for Preference refactoring.
This commit is contained in:
parent
50feb2c612
commit
8e70a87e5d
@ -542,7 +542,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getSelectedItem() {
|
public Object getSelectedItem() {
|
||||||
if (Prefs.NODE.getBoolean(preference, def)) {
|
if (Prefs.getBoolean(preference, def)) {
|
||||||
return trueDesc;
|
return trueDesc;
|
||||||
} else {
|
} else {
|
||||||
return falseDesc;
|
return falseDesc;
|
||||||
@ -560,9 +560,9 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (trueDesc.equals(item)) {
|
if (trueDesc.equals(item)) {
|
||||||
Prefs.NODE.putBoolean(preference, true);
|
Prefs.putBoolean(preference, true);
|
||||||
} else if (falseDesc.equals(item)) {
|
} else if (falseDesc.equals(item)) {
|
||||||
Prefs.NODE.putBoolean(preference, false);
|
Prefs.putBoolean(preference, false);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Illegal argument " + item);
|
throw new IllegalArgumentException("Illegal argument " + item);
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
|
|
||||||
if (check.isSelected()) {
|
if (check.isSelected()) {
|
||||||
// Save the preference
|
// Save the preference
|
||||||
Prefs.NODE.putInt(Prefs.BODY_COMPONENT_INSERT_POSITION_KEY, sel);
|
Prefs.putInt(Prefs.BODY_COMPONENT_INSERT_POSITION_KEY, sel);
|
||||||
}
|
}
|
||||||
return sel;
|
return sel;
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ public class RocketActions {
|
|||||||
|
|
||||||
|
|
||||||
private boolean verifyDeleteSimulation() {
|
private boolean verifyDeleteSimulation() {
|
||||||
boolean verify = Prefs.NODE.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
|
boolean verify = Prefs.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
|
||||||
if (verify) {
|
if (verify) {
|
||||||
JPanel panel = new JPanel(new MigLayout());
|
JPanel panel = new JPanel(new MigLayout());
|
||||||
//// Do not ask me again
|
//// Do not ask me again
|
||||||
@ -233,7 +233,7 @@ public class RocketActions {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (dontAsk.isSelected()) {
|
if (dontAsk.isSelected()) {
|
||||||
Prefs.NODE.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
|
Prefs.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ public class SimulationEditDialog extends JDialog {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
String previous = Prefs.NODE.get("previousListenerName", "");
|
String previous = Prefs.getString("previousListenerName", "");
|
||||||
String input = (String) JOptionPane.showInputDialog(SimulationEditDialog.this,
|
String input = (String) JOptionPane.showInputDialog(SimulationEditDialog.this,
|
||||||
new Object[] {
|
new Object[] {
|
||||||
//// Type the full Java class name of the simulation listener, for example:
|
//// 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(""))
|
if (input == null || input.equals(""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Prefs.NODE.put("previousListenerName", input);
|
Prefs.putString("previousListenerName", input);
|
||||||
simulation.getSimulationListeners().add(input);
|
simulation.getSimulationListeners().add(input);
|
||||||
listenerModel.fireContentsChanged();
|
listenerModel.fireContentsChanged();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
return; // TODO: LOW: "None selected" dialog
|
return; // TODO: LOW: "None selected" dialog
|
||||||
|
|
||||||
// Verify deletion
|
// Verify deletion
|
||||||
boolean verify = Prefs.NODE.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
|
boolean verify = Prefs.getBoolean(Prefs.CONFIRM_DELETE_SIMULATION, true);
|
||||||
if (verify) {
|
if (verify) {
|
||||||
|
|
||||||
JPanel panel = new JPanel(new MigLayout());
|
JPanel panel = new JPanel(new MigLayout());
|
||||||
@ -180,7 +180,7 @@ public class SimulationPanel extends JPanel {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (dontAsk.isSelected()) {
|
if (dontAsk.isSelected()) {
|
||||||
Prefs.NODE.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
|
Prefs.putBoolean(Prefs.CONFIRM_DELETE_SIMULATION, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,12 +158,6 @@ public class Prefs {
|
|||||||
public static final String PREFERRED_THRUST_CURVE_MOTOR_NODE = "preferredThrustCurveMotors";
|
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;
|
private static final Preferences PREFNODE;
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +174,6 @@ public class Prefs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PREFNODE = root.node(NODENAME);
|
PREFNODE = root.node(NODENAME);
|
||||||
NODE = PREFNODE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -388,7 +381,14 @@ public class Prefs {
|
|||||||
storeVersion();
|
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.
|
* Return a preferences object for the specified node name.
|
||||||
*
|
*
|
||||||
@ -595,11 +595,6 @@ public class Prefs {
|
|||||||
return 0.3;
|
return 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getInt( String key, int defaultValue ) {
|
|
||||||
return PREFNODE.getInt(key, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static Material getDefaultComponentMaterial(
|
public static Material getDefaultComponentMaterial(
|
||||||
Class<? extends RocketComponent> componentClass,
|
Class<? extends RocketComponent> componentClass,
|
||||||
Material.Type type) {
|
Material.Type type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user