Ensure units are updated upon preferences importing
This commit is contained in:
parent
5af6827e92
commit
aa154c49da
@ -154,9 +154,6 @@ public class PreferencesDialog extends JDialog {
|
||||
initPrefsFile.delete();
|
||||
}
|
||||
|
||||
// Ensure the units are properly stored
|
||||
preferences.storeDefaultUnits();
|
||||
|
||||
// Make sure unit change applies to the rocket figure
|
||||
if (parent != null) {
|
||||
parent.getRocketPanel().updateExtras();
|
||||
|
@ -49,6 +49,10 @@ public abstract class PreferencesImporter {
|
||||
public static boolean importPreferences(File importFile) {
|
||||
try (FileInputStream fis = new FileInputStream(importFile)) {
|
||||
Preferences.importPreferences(fis);
|
||||
|
||||
// Ensure units are updated
|
||||
((SwingPreferences) Application.getPreferences()).loadDefaultUnits();
|
||||
|
||||
log.info("Preferences imported successfully.");
|
||||
return true;
|
||||
} catch (IOException | InvalidPreferencesFormatException e) {
|
||||
|
@ -625,7 +625,10 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
|
||||
|
||||
///////// Default unit storage
|
||||
|
||||
|
||||
/**
|
||||
* Loads the default units from the preferences.
|
||||
*/
|
||||
public void loadDefaultUnits() {
|
||||
Preferences prefs = PREFNODE.node("units");
|
||||
try {
|
||||
@ -645,7 +648,10 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
||||
Application.getExceptionHandler().handleErrorCondition(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stores the standard default units in the preferences.
|
||||
*/
|
||||
public void storeDefaultUnits() {
|
||||
Preferences prefs = PREFNODE.node("units");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user