From 54a6d956e264454639f8d9c2df75cc581295274c Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 6 Apr 2015 07:08:15 -0500 Subject: [PATCH] auto-sync --- java_console/ui/src/com/rusefi/Launcher.java | 9 ++++++--- java_console/ui/src/com/rusefi/StartupFrame.java | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index 002279fe06..bfbb483e22 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -34,9 +34,10 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; * @see com.rusefi.StartupFrame */ public class Launcher { - public static final int CONSOLE_VERSION = 20150405; + public static final int CONSOLE_VERSION = 20150406; public static final boolean SHOW_STIMULATOR = false; - public static final String TAB_INDEX = "main_tab"; + private static final String TAB_INDEX = "main_tab"; + protected static final String PORT_KEY = "port"; private final String port; private final JTabbedPane tabbedPane = new JTabbedPane(); @@ -70,6 +71,8 @@ public class Launcher { staticFrame = frame.getFrame(); FileLog.MAIN.start(); + getConfig().getRoot().setProperty(PORT_KEY, port); + LinkManager.start(port); FileLog.MAIN.logLine("Console " + CONSOLE_VERSION); @@ -102,7 +105,7 @@ public class Launcher { if (!LinkManager.isLogViewerMode(port)) { - int selectedIndex = getConfig().getRoot().getIntProperty("main_tab", 2); + int selectedIndex = getConfig().getRoot().getIntProperty(TAB_INDEX, 2); if (selectedIndex < tabbedPane.getTabCount()) tabbedPane.setSelectedIndex(selectedIndex); } diff --git a/java_console/ui/src/com/rusefi/StartupFrame.java b/java_console/ui/src/com/rusefi/StartupFrame.java index bab21b3734..22665747a5 100644 --- a/java_console/ui/src/com/rusefi/StartupFrame.java +++ b/java_console/ui/src/com/rusefi/StartupFrame.java @@ -23,6 +23,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; + /** * This frame is used on startup to select the port we would be using * @@ -128,6 +130,8 @@ public class StartupFrame { for (final String port : ports) comboPorts.addItem(port); panel.add(comboPorts); + String defaultPort = getConfig().getRoot().getProperty(Launcher.PORT_KEY, ""); + comboPorts.setSelectedItem(defaultPort); final JComboBox comboSpeeds = createSpeedCombo(); // panel.add(comboSpeeds);