diff --git a/src/com/romraider/ECUEditor.java b/src/com/romraider/ECUEditor.java index 7feff5b6..621e3ba4 100644 --- a/src/com/romraider/ECUEditor.java +++ b/src/com/romraider/ECUEditor.java @@ -21,6 +21,8 @@ package com.romraider; +import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.Version.VERSION; import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; import com.romraider.maps.Rom; import com.romraider.maps.Table; @@ -35,7 +37,6 @@ import com.romraider.swing.RomTreeRootNode; import com.romraider.swing.TableFrame; import com.romraider.util.SettingsManager; import com.romraider.util.SettingsManagerImpl; -import com.romraider.Version; // this is a generated class - see build.xml import com.romraider.xml.DOMRomUnmarshaller; import com.romraider.xml.RomNotFoundException; import com.sun.org.apache.xerces.internal.parsers.DOMParser; @@ -72,7 +73,7 @@ import java.io.IOException; import java.util.Vector; public class ECUEditor extends JFrame implements WindowListener, PropertyChangeListener { - private String titleText = Version.PRODUCT_NAME + " v" + Version.VERSION; + private String titleText = PRODUCT_NAME + " v" + VERSION + " | ECU Editor"; private static final String NEW_LINE = System.getProperty("line.separator"); private final SettingsManager settingsManager = new SettingsManagerImpl(); @@ -91,7 +92,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL // get settings from xml settings = settingsManager.load("A new file will be created."); - if (!settings.getRecentVersion().equalsIgnoreCase(Version.VERSION)) { + if (!settings.getRecentVersion().equalsIgnoreCase(VERSION)) { showReleaseNotes(); } @@ -155,7 +156,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL releaseNotes.setText(sb.toString()); JOptionPane.showMessageDialog(this, scroller, - Version.PRODUCT_NAME + Version.VERSION + " Release Notes", JOptionPane.INFORMATION_MESSAGE); + PRODUCT_NAME + VERSION + " Release Notes", JOptionPane.INFORMATION_MESSAGE); } finally { br.close(); } @@ -198,7 +199,7 @@ public class ECUEditor extends JFrame implements WindowListener, PropertyChangeL } public String getVersion() { - return Version.VERSION; + return VERSION; } public Settings getSettings() { diff --git a/src/com/romraider/NewGUI/NewGUI.java b/src/com/romraider/NewGUI/NewGUI.java index 1a7a9a66..c8cc101e 100644 --- a/src/com/romraider/NewGUI/NewGUI.java +++ b/src/com/romraider/NewGUI/NewGUI.java @@ -8,6 +8,8 @@ import com.romraider.NewGUI.interfaces.TuningEntity; import com.romraider.NewGUI.interfaces.TuningEntityListener; import com.romraider.NewGUI.tree.ETree; import com.romraider.NewGUI.tree.ETreeNode; +import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.Version.VERSION; import com.romraider.logger.utec.impl.UtecTuningEntityImpl; import com.romraider.swing.LookAndFeelManager; import org.apache.log4j.Logger; @@ -35,7 +37,7 @@ import java.util.Vector; public class NewGUI extends JFrame implements WindowListener, ActionListener, TreeSelectionListener, TuningEntityListener { private static final Logger LOGGER = Logger.getLogger(NewGUI.class); - private final String romRaiderVersionTitle = "RomRaider v0.5.0 alpha 1"; + private final String romRaiderVersionTitle = PRODUCT_NAME + " v" + VERSION; private JPanel mainJPanel = new JPanel(); @@ -45,7 +47,7 @@ public class NewGUI extends JFrame implements WindowListener, ActionListener, private JSplitPane splitPane = new JSplitPane(); private EDesktopPane rightDesktopPane = new EDesktopPane(); - private ETreeNode rootNode = new ETreeNode("RomRaider", new TableMetaData( + private ETreeNode rootNode = new ETreeNode(PRODUCT_NAME, new TableMetaData( TableMetaData.RESERVED_ROOT, 0.0, 0.0, new Object[0], null, null, false, "", "", "", "", "", null)); private ETree leftJTree = new ETree(rootNode); @@ -286,7 +288,7 @@ public class NewGUI extends JFrame implements WindowListener, ActionListener, } /** - * Getter that returns the title of RomRaider + * Getter that returns the title * * @return */ @@ -300,7 +302,7 @@ public class NewGUI extends JFrame implements WindowListener, ActionListener, * @see com.romraider.NewGUI.interfaces.TuningEntityListener#readyForExit() */ public void readyForExit() { - LOGGER.info("RomRaider is now exiting as per tuning entity notification: " + ApplicationStateManager.getCurrentTuningEntity().getName()); + LOGGER.info(PRODUCT_NAME + " is now exiting as per tuning entity notification: " + ApplicationStateManager.getCurrentTuningEntity().getName()); System.exit(0); } @@ -317,14 +319,14 @@ public class NewGUI extends JFrame implements WindowListener, ActionListener, } public void windowClosing(WindowEvent e) { - LOGGER.info("Preparing RomRaider for exit."); + LOGGER.info("Preparing " + PRODUCT_NAME + " for exit."); TuningEntity currentTuningEntity = ApplicationStateManager .getCurrentTuningEntity(); if (currentTuningEntity == null) { LOGGER.debug("No Tuning Entity ever selected."); - LOGGER.info("RomRaider exiting immediately."); + LOGGER.info(PRODUCT_NAME + " exiting immediately."); System.exit(0); } else { LOGGER.debug("Notify current tuning entity of pending exit."); diff --git a/src/com/romraider/Settings.java b/src/com/romraider/Settings.java index 682d0060..da20a37c 100644 --- a/src/com/romraider/Settings.java +++ b/src/com/romraider/Settings.java @@ -21,10 +21,12 @@ package com.romraider; +import static com.romraider.Version.RELEASE_NOTES; +import static com.romraider.Version.ROM_REVISION_URL; +import static com.romraider.Version.SUPPORT_URL; import com.romraider.io.connection.ConnectionProperties; import com.romraider.logger.ecu.definition.EcuDefinition; import static com.romraider.util.ParamChecker.checkNotNullOrEmpty; -import com.romraider.Version; // this is a generated class - see build.xml import java.awt.Color; import java.awt.Dimension; import java.awt.Font; @@ -144,11 +146,11 @@ public class Settings implements Serializable { } public String getRomRevisionURL() { - return Version.ROM_REVISION_URL; + return ROM_REVISION_URL; } public String getSupportURL() { - return Version.SUPPORT_URL; + return SUPPORT_URL; } public Font getTableFont() { @@ -270,7 +272,7 @@ public class Settings implements Serializable { } public String getReleaseNotes() { - return Version.RELEASE_NOTES; + return RELEASE_NOTES; } public boolean isSaveDebugTables() { @@ -361,10 +363,6 @@ public class Settings implements Serializable { this.loggerOutputDirPath = loggerOutputDirPath; } - public String getEcuDefsURL() { - return Version.ECU_DEFS_URL; - } - public String getFileLoggingControllerSwitchId() { return fileLoggingControllerSwitchId; } diff --git a/src/com/romraider/Version.java.template b/src/com/romraider/Version.java.template index 51f3143b..78347790 100644 --- a/src/com/romraider/Version.java.template +++ b/src/com/romraider/Version.java.template @@ -30,10 +30,9 @@ public final class Version { public static final String SUPPORT_URL = "@supporturl@"; public static final String ROM_REVISION_URL = "@romrevisionurl@"; public static final String ECU_DEFS_URL = "@ecudefsurl@"; - // logger defs URL not currently used, but added for completeness public static final String LOGGER_DEFS_URL = "@loggerdefsurl@"; public static final String RELEASE_NOTES = "@release_notes@"; - public Version() { + private Version() { } } \ No newline at end of file diff --git a/src/com/romraider/logger/ecu/EcuLogger.java b/src/com/romraider/logger/ecu/EcuLogger.java index 7dcb67ee..1b30a41c 100644 --- a/src/com/romraider/logger/ecu/EcuLogger.java +++ b/src/com/romraider/logger/ecu/EcuLogger.java @@ -23,6 +23,8 @@ package com.romraider.logger.ecu; import com.romraider.ECUEditor; import com.romraider.Settings; +import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.Version.VERSION; import com.romraider.io.port.SerialPortRefresher; import com.romraider.logger.ecu.comms.controller.LoggerController; import com.romraider.logger.ecu.comms.controller.LoggerControllerImpl; @@ -149,7 +151,7 @@ TODO: Add log analysis tab (or maybe new window?), including log playback, custo public final class EcuLogger extends JFrame implements WindowListener, PropertyChangeListener, MessageListener { private static final Logger LOGGER = Logger.getLogger(EcuLogger.class); - private static final String ECU_LOGGER_TITLE = "RomRaider ECU Logger"; + private static final String ECU_LOGGER_TITLE = PRODUCT_NAME + " v" + VERSION + " | ECU Logger"; private static final String HEADING_PARAMETERS = "Parameters"; private static final String HEADING_SWITCHES = "Switches"; private static final String HEADING_EXTERNAL = "External"; diff --git a/src/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java b/src/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java index a82d16c4..ed49e303 100644 --- a/src/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java +++ b/src/com/romraider/logger/ecu/ui/swing/menubar/EcuLoggerMenuBar.java @@ -14,6 +14,7 @@ import com.romraider.logger.ecu.ui.swing.menubar.action.ResetConnectionAction; import com.romraider.logger.ecu.ui.swing.menubar.action.ResetEcuAction; import com.romraider.logger.ecu.ui.swing.menubar.action.SaveProfileAction; import com.romraider.logger.ecu.ui.swing.menubar.action.SaveProfileAsAction; +import com.romraider.logger.ecu.ui.swing.menubar.action.UpdateLoggerDefAction; import javax.swing.Action; import javax.swing.JMenu; import javax.swing.JMenuBar; @@ -33,6 +34,7 @@ import static java.awt.event.KeyEvent.VK_P; import static java.awt.event.KeyEvent.VK_R; import static java.awt.event.KeyEvent.VK_S; import static java.awt.event.KeyEvent.VK_T; +import static java.awt.event.KeyEvent.VK_U; import static java.awt.event.KeyEvent.VK_X; import java.util.List; @@ -82,6 +84,8 @@ public class EcuLoggerMenuBar extends JMenuBar { // help menu stuff JMenu helpMenu = new EcuLoggerMenu("Help", VK_H); + helpMenu.add(new EcuLoggerMenuItem("Update Logger Definition...", new UpdateLoggerDefAction(logger), VK_U)); + helpMenu.add(new JSeparator()); helpMenu.add(new EcuLoggerMenuItem("About", new AboutAction(logger), VK_A)); add(helpMenu); diff --git a/src/com/romraider/logger/ecu/ui/swing/menubar/action/AboutAction.java b/src/com/romraider/logger/ecu/ui/swing/menubar/action/AboutAction.java index bb4bd0f6..431da437 100644 --- a/src/com/romraider/logger/ecu/ui/swing/menubar/action/AboutAction.java +++ b/src/com/romraider/logger/ecu/ui/swing/menubar/action/AboutAction.java @@ -1,6 +1,9 @@ package com.romraider.logger.ecu.ui.swing.menubar.action; -import com.romraider.Version; +import static com.romraider.Version.BUILDNUMBER; +import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.Version.SUPPORT_URL; +import static com.romraider.Version.VERSION; import com.romraider.logger.ecu.EcuLogger; import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.showMessageDialog; @@ -13,9 +16,10 @@ public final class AboutAction extends AbstractAction { } public void actionPerformed(ActionEvent actionEvent) { - showMessageDialog(logger, - Version.PRODUCT_NAME + " RomRaider ECU logger\n" + "Version " + Version.VERSION + "\n" + - "Build ID: " + Version.BUILDNUMBER + "\n" + Version.SUPPORT_URL, - "About " + Version.PRODUCT_NAME, INFORMATION_MESSAGE); + String message = PRODUCT_NAME + " ECU Logger\n" + + "Version: " + VERSION + " [build #" + BUILDNUMBER + "]\n" + + SUPPORT_URL; + String title = "About " + PRODUCT_NAME; + showMessageDialog(logger, message, title, INFORMATION_MESSAGE); } } diff --git a/src/com/romraider/logger/ecu/ui/swing/menubar/action/UpdateLoggerDefAction.java b/src/com/romraider/logger/ecu/ui/swing/menubar/action/UpdateLoggerDefAction.java new file mode 100644 index 00000000..a10f043e --- /dev/null +++ b/src/com/romraider/logger/ecu/ui/swing/menubar/action/UpdateLoggerDefAction.java @@ -0,0 +1,17 @@ +package com.romraider.logger.ecu.ui.swing.menubar.action; + +import static com.centerkey.utils.BareBonesBrowserLaunch.openURL; +import static com.romraider.Version.LOGGER_DEFS_URL; +import com.romraider.logger.ecu.EcuLogger; +import java.awt.event.ActionEvent; + +public final class UpdateLoggerDefAction extends AbstractAction { + + public UpdateLoggerDefAction(EcuLogger logger) { + super(logger); + } + + public void actionPerformed(ActionEvent actionEvent) { + openURL(LOGGER_DEFS_URL); + } +} \ No newline at end of file diff --git a/src/com/romraider/swing/DebugPanel.java b/src/com/romraider/swing/DebugPanel.java index 49468f61..b0cd0d63 100644 --- a/src/com/romraider/swing/DebugPanel.java +++ b/src/com/romraider/swing/DebugPanel.java @@ -21,6 +21,7 @@ package com.romraider.swing; +import static com.romraider.Version.PRODUCT_NAME; import com.romraider.net.URL; import javax.swing.JLabel; import javax.swing.JPanel; @@ -34,7 +35,7 @@ public class DebugPanel extends JPanel { setLayout(new BorderLayout()); JPanel top = new JPanel(new GridLayout(7, 1)); - top.add(new JLabel("RomRaider has encountered an exception. Please review the details below.")); + top.add(new JLabel(PRODUCT_NAME + " has encountered an exception. Please review the details below.")); top.add(new JLabel("If you are unable to fix this problem please visit the following website")); top.add(new JLabel("and provide these details and the steps that lead to this error.")); top.add(new JLabel()); diff --git a/src/com/romraider/swing/ECUEditorMenuBar.java b/src/com/romraider/swing/ECUEditorMenuBar.java index 1acbda51..8086ad84 100644 --- a/src/com/romraider/swing/ECUEditorMenuBar.java +++ b/src/com/romraider/swing/ECUEditorMenuBar.java @@ -21,10 +21,17 @@ package com.romraider.swing; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.File; -import java.io.FileOutputStream; +import com.centerkey.utils.BareBonesBrowserLaunch; +import com.romraider.ECUEditor; +import static com.romraider.Version.BUILDNUMBER; +import static com.romraider.Version.ECU_DEFS_URL; +import static com.romraider.Version.PRODUCT_NAME; +import static com.romraider.Version.SUPPORT_URL; +import static com.romraider.Version.VERSION; +import com.romraider.logger.ecu.EcuLogger; +import com.romraider.logger.utec.gui.JutecGUI; +import com.romraider.maps.Rom; +import com.romraider.ramtune.test.RamTuneTestApp; import javax.swing.ButtonGroup; import javax.swing.JFileChooser; import static javax.swing.JFrame.DISPOSE_ON_CLOSE; @@ -38,13 +45,10 @@ import static javax.swing.JOptionPane.showConfirmDialog; import static javax.swing.JOptionPane.showMessageDialog; import javax.swing.JRadioButtonMenuItem; import javax.swing.JSeparator; -import com.centerkey.utils.BareBonesBrowserLaunch; -import com.romraider.Version; // this is a generated class - see build.xml -import com.romraider.ECUEditor; -import com.romraider.logger.ecu.EcuLogger; -import com.romraider.logger.utec.gui.JutecGUI; -import com.romraider.maps.Rom; -import com.romraider.ramtune.test.RamTuneTestApp; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileOutputStream; public class ECUEditorMenuBar extends JMenuBar implements ActionListener { @@ -62,7 +66,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener { private JMenuItem updateDefinition = new JMenuItem("Update ECU Definitions..."); private JMenu editMenu = new JMenu("Edit"); - private JMenuItem settings = new JMenuItem(Version.PRODUCT_NAME + " Settings..."); + private JMenuItem settings = new JMenuItem(PRODUCT_NAME + " Settings..."); private JMenu viewMenu = new JMenu("View"); private JMenuItem romProperties = new JMenuItem("ECU Image Properties"); @@ -82,7 +86,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener { private JMenuItem launchRamTuneTestApp = new JMenuItem("Launch Test App..."); private JMenu helpMenu = new JMenu("Help"); - private JMenuItem about = new JMenuItem("About " + Version.PRODUCT_NAME); + private JMenuItem about = new JMenuItem("About " + PRODUCT_NAME); private ECUEditor parent; @@ -291,21 +295,21 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener { EcuLogger.startLogger(DISPOSE_ON_CLOSE, parent); } else if (e.getSource() == utecLogger) { - JutecGUI.startLogger(DISPOSE_ON_CLOSE, parent.getSettings()); + JutecGUI.startLogger(DISPOSE_ON_CLOSE, parent.getSettings()); } else if (e.getSource() == updateDefinition) { - BareBonesBrowserLaunch.openURL(parent.getSettings().getEcuDefsURL()); + BareBonesBrowserLaunch.openURL(ECU_DEFS_URL); } else if (e.getSource() == launchRamTuneTestApp) { RamTuneTestApp.startTestApp(DISPOSE_ON_CLOSE); } else if (e.getSource() == about) { - //TODO: make a separate About class to get a better dialog box - // with graphic, hyperlink, etc. - showMessageDialog(this, - Version.PRODUCT_NAME + " ECU Editor\n" + "Version " + Version.VERSION + "\n" + - "Build ID: " + Version.BUILDNUMBER + "\n" + Version.SUPPORT_URL, - "About " + Version.PRODUCT_NAME, INFORMATION_MESSAGE); + //TODO: make a separate About class to get a better dialog box with graphic, hyperlink, etc. + String message = PRODUCT_NAME + " ECU Editor\n" + + "Version: " + VERSION + " [build #" + BUILDNUMBER + "]\n" + + SUPPORT_URL; + String title = "About " + PRODUCT_NAME; + showMessageDialog(parent, message, title, INFORMATION_MESSAGE); } } diff --git a/src/com/romraider/swing/LookAndFeelManager.java b/src/com/romraider/swing/LookAndFeelManager.java index d59a9e4f..c73f8113 100644 --- a/src/com/romraider/swing/LookAndFeelManager.java +++ b/src/com/romraider/swing/LookAndFeelManager.java @@ -21,6 +21,7 @@ package com.romraider.swing; +import static com.romraider.Version.PRODUCT_NAME; import org.apache.log4j.Logger; import javax.swing.JDialog; import javax.swing.JFrame; @@ -45,7 +46,7 @@ public final class LookAndFeelManager { System.setProperty("apple.awt.brushMetalLook", "true"); System.setProperty("apple.laf.useScreenMenuBar", "true"); System.setProperty("apple.awt.window.position.forceSafeCreation", "true"); - System.setProperty("com.apple.mrj.application.apple.menu.about.name", "RomRaider"); + System.setProperty("com.apple.mrj.application.apple.menu.about.name", PRODUCT_NAME); } // Linux has issues with the gtk look and feel themes. diff --git a/src/com/romraider/swing/SettingsForm.java b/src/com/romraider/swing/SettingsForm.java index 55b5b2c6..c52a55b4 100644 --- a/src/com/romraider/swing/SettingsForm.java +++ b/src/com/romraider/swing/SettingsForm.java @@ -24,6 +24,7 @@ package com.romraider.swing; import ZoeloeSoft.projects.JFontChooser.JFontChooser; import com.romraider.ECUEditor; import com.romraider.Settings; +import static com.romraider.Version.PRODUCT_NAME; import com.romraider.util.FileAssociator; import javax.swing.JColorChooser; import javax.swing.JFrame; @@ -32,6 +33,7 @@ import java.awt.Dimension; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; +import static java.io.File.separator; import java.util.StringTokenizer; public class SettingsForm extends JFrame implements MouseListener { @@ -149,7 +151,7 @@ public class SettingsForm extends JFrame implements MouseListener { tableClickCount = new javax.swing.JComboBox(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("RomRaider Settings"); + setTitle(PRODUCT_NAME + " Settings"); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setFont(new java.awt.Font("Tahoma", 0, 11)); obsoleteWarning.setText("Warn me when opening out of date ECU image revision"); @@ -528,11 +530,11 @@ public class SettingsForm extends JFrame implements MouseListener { // add file associations for selected file types try { if (extensionHex.isSelected()) { - FileAssociator.addAssociation("HEX", new File(".").getCanonicalPath() + "\\RomRaider.exe", "ECU Image"); + FileAssociator.addAssociation("HEX", new File(".").getCanonicalPath() + separator + PRODUCT_NAME + ".exe", "ECU Image"); } if (extensionBin.isSelected()) { - FileAssociator.addAssociation("BIN", new File(".").getCanonicalPath() + "\\RomRaider.exe", "ECU Image"); + FileAssociator.addAssociation("BIN", new File(".").getCanonicalPath() + separator + PRODUCT_NAME + ".exe", "ECU Image"); } } catch (Exception ex) { } diff --git a/templates/shortcutSpec-linux.xml.template b/templates/shortcutSpec-linux.xml.template index c3379760..31d95c48 100644 --- a/templates/shortcutSpec-linux.xml.template +++ b/templates/shortcutSpec-linux.xml.template @@ -2,7 +2,7 @@ - + - +