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();
|
initPrefsFile.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure the units are properly stored
|
|
||||||
preferences.storeDefaultUnits();
|
|
||||||
|
|
||||||
// Make sure unit change applies to the rocket figure
|
// Make sure unit change applies to the rocket figure
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.getRocketPanel().updateExtras();
|
parent.getRocketPanel().updateExtras();
|
||||||
|
@ -49,6 +49,10 @@ public abstract class PreferencesImporter {
|
|||||||
public static boolean importPreferences(File importFile) {
|
public static boolean importPreferences(File importFile) {
|
||||||
try (FileInputStream fis = new FileInputStream(importFile)) {
|
try (FileInputStream fis = new FileInputStream(importFile)) {
|
||||||
Preferences.importPreferences(fis);
|
Preferences.importPreferences(fis);
|
||||||
|
|
||||||
|
// Ensure units are updated
|
||||||
|
((SwingPreferences) Application.getPreferences()).loadDefaultUnits();
|
||||||
|
|
||||||
log.info("Preferences imported successfully.");
|
log.info("Preferences imported successfully.");
|
||||||
return true;
|
return true;
|
||||||
} catch (IOException | InvalidPreferencesFormatException e) {
|
} catch (IOException | InvalidPreferencesFormatException e) {
|
||||||
|
@ -626,6 +626,9 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
|||||||
|
|
||||||
///////// Default unit storage
|
///////// Default unit storage
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the default units from the preferences.
|
||||||
|
*/
|
||||||
public void loadDefaultUnits() {
|
public void loadDefaultUnits() {
|
||||||
Preferences prefs = PREFNODE.node("units");
|
Preferences prefs = PREFNODE.node("units");
|
||||||
try {
|
try {
|
||||||
@ -646,6 +649,9 @@ public class SwingPreferences extends net.sf.openrocket.startup.Preferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stores the standard default units in the preferences.
|
||||||
|
*/
|
||||||
public void storeDefaultUnits() {
|
public void storeDefaultUnits() {
|
||||||
Preferences prefs = PREFNODE.node("units");
|
Preferences prefs = PREFNODE.node("units");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user