Show warning dialog about restarting OR after preferences import

This commit is contained in:
SiboVG 2023-04-07 01:56:11 +02:00
parent 0f09497275
commit 8a52185322
2 changed files with 15 additions and 7 deletions

View File

@ -378,6 +378,8 @@ PreferencesDialog.lbl.languageEffect = The language will change the next time yo
generalprefs.lbl.language = Interface language
generalprefs.languages.default = System default
generalprefs.lbl.languageEffect = The language will change the next time you start OpenRocket.
generalprefs.ImportWarning.title = Reload OpenRocket
generalprefs.ImportWarning.msg = You may need to restart OpenRocket for some of the changes to take effect.
PreferencesExporter.chooser.title = Export the Preferences File

View File

@ -264,13 +264,19 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
importPreferences.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PreferencesImporter.importPreferences(parent);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PreferencesDialog.showPreferences(parent.getParentFrame()); // Refresh the preferences dialog
}
});
boolean imported = PreferencesImporter.importPreferences(parent);
if (imported) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
JOptionPane.showMessageDialog(parent,
trans.get("generalprefs.ImportWarning.msg"),
trans.get("generalprefs.ImportWarning.title"),
JOptionPane.WARNING_MESSAGE);
PreferencesDialog.showPreferences(parent.getParentFrame()); // Refresh the preferences dialog
}
});
}
}
});
buttonPanel.add(importPreferences);