X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FMain.java;h=75c145385da37e19960f5bcd3fdfec150b1e9fba;hb=3b53ea254e50420df8fe2ea9121855d600560f88;hp=5601329319d6cc7796d9b048f6838307a3c8cd14;hpb=b185db9445322aca4df3f68a14522d45fa9d5f90;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/Main.java b/src/de/todesbaum/jsite/main/Main.java index 5601329..75c1453 100644 --- a/src/de/todesbaum/jsite/main/Main.java +++ b/src/de/todesbaum/jsite/main/Main.java @@ -73,7 +73,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen private static boolean debug = false; /** The version. */ - private static final Version VERSION = new Version(0, 6, 2); + private static final Version VERSION = new Version(0, 7); /** The configuration. */ private Configuration configuration; @@ -173,7 +173,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen jSiteIcon = IconLoader.loadIcon("/jsite-icon.png"); wizard.setIcon(jSiteIcon); - updateChecker = new UpdateChecker(wizard, freenetInterface); + updateChecker = new UpdateChecker(freenetInterface); updateChecker.addUpdateListener(this); updateChecker.start(); @@ -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 // @@ -449,7 +466,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-node-selected"), null, JOptionPane.ERROR_MESSAGE); return; } - if (project.getIndexFile() == null) { + if ((project.getIndexFile() == null) || (project.getIndexFile().length() == 0)) { if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.empty-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) { return; }