From: David ‘Bombe’ Roden Date: Wed, 24 Dec 2008 11:13:04 +0000 (+0100) Subject: Show dialog box with latest version information. X-Git-Tag: 0.7~5 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=442a672236ca1138ac5f473ed2a5e6f14dad9511;p=jSite.git Show dialog box with latest version information. --- diff --git a/src/de/todesbaum/jsite/main/Main.java b/src/de/todesbaum/jsite/main/Main.java index b760a79..cc65c3d 100644 --- a/src/de/todesbaum/jsite/main/Main.java +++ b/src/de/todesbaum/jsite/main/Main.java @@ -208,8 +208,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen /** * {@inheritDoc} */ + @SuppressWarnings("synthetic-access") public void actionPerformed(ActionEvent actionEvent) { - /* TODO */ + showLatestUpdate(); } }; aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) { @@ -404,6 +405,22 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen configuration.setLocale(supportedLocale); } + /** + * Shows a dialog box that shows the last version that was found by the + * {@link UpdateChecker}. + */ + private void showLatestUpdate() { + Version latestVersion = updateChecker.getLatestVersion(); + int versionDifference = latestVersion.compareTo(VERSION); + if (versionDifference > 0) { + JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.newer.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE); + } else if (versionDifference < 0) { + JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.older.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE); + } else { + JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.update-checker.latest-version.okay.message"), VERSION, latestVersion), I18n.getMessage("jsite.update-checker.latest-version.title"), JOptionPane.INFORMATION_MESSAGE); + } + } + // // INTERFACE ListSelectionListener //