diff --git a/src/enginuity/logger/ecu/EcuLogger.java b/src/enginuity/logger/ecu/EcuLogger.java index c0abe3d0..99f61033 100644 --- a/src/enginuity/logger/ecu/EcuLogger.java +++ b/src/enginuity/logger/ecu/EcuLogger.java @@ -70,6 +70,7 @@ import enginuity.logger.ecu.ui.swing.menubar.EcuLoggerMenuBar; import enginuity.logger.ecu.ui.swing.menubar.action.ToggleButtonAction; import static enginuity.util.ParamChecker.checkNotNull; import static enginuity.util.ParamChecker.isNullOrEmpty; +import enginuity.util.SettingsManagerImpl; import static enginuity.util.ThreadUtil.runAsDaemon; import static enginuity.util.ThreadUtil.sleep; import org.apache.log4j.Logger; @@ -847,9 +848,14 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC LOGGER.warn("Error stopping logger", e); } finally { rememberWindowProperties(); + saveSettings(); } } + private void saveSettings() { + new SettingsManagerImpl().save(settings); + } + private void rememberWindowProperties() { settings.setLoggerWindowMaximized(getExtendedState() == MAXIMIZED_BOTH); settings.setLoggerWindowSize(getSize()); diff --git a/src/enginuity/util/SettingsManager.java b/src/enginuity/util/SettingsManager.java index 0c3a88aa..0c3a543b 100644 --- a/src/enginuity/util/SettingsManager.java +++ b/src/enginuity/util/SettingsManager.java @@ -6,5 +6,7 @@ import enginuity.swing.JProgressPane; public interface SettingsManager { Settings load(String settingsNotFoundMessage); + void save(Settings settings); + void save(Settings settings, JProgressPane progress, String version); } diff --git a/src/enginuity/util/SettingsManagerImpl.java b/src/enginuity/util/SettingsManagerImpl.java index 538277a6..fde8c939 100644 --- a/src/enginuity/util/SettingsManagerImpl.java +++ b/src/enginuity/util/SettingsManagerImpl.java @@ -34,10 +34,13 @@ public final class SettingsManagerImpl implements SettingsManager { } } + public void save(Settings settings) { + save(settings, new JProgressPane(), ""); + } + public void save(Settings settings, JProgressPane progress, String version) { DOMSettingsBuilder builder = new DOMSettingsBuilder(); try { - //JProgressPane progress = new JProgressPane(this, "Saving settings...", "Saving settings..."); builder.buildSettings(settings, new File("./settings.xml"), progress, version); } catch (Exception e) { // ignore