work in progress
[jSite.git] / src / de / todesbaum / jsite / main / Main.java
index 2f538d0..abe9b73 100644 (file)
@@ -69,6 +69,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /** Whether the debug mode is activated. */
        private static boolean debug = false;
 
+       /** The URL for update checks. */
+       private static final String UPDATE_KEY = "USK@e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE/jSite/0/currentVersion.txt";
+
        /** The configuration. */
        private Configuration configuration;
 
@@ -108,6 +111,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
        /** The “manage nodes” action. */
        private Action manageNodeAction;
 
+       /** The “check for updates” action. */
+       private Action checkForUpdatesAction;
+
        /** The “about jSite” action. */
        private Action aboutAction;
 
@@ -145,8 +151,11 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                Locale.setDefault(configuration.getLocale());
                I18n.setLocale(configuration.getLocale());
                if (!configuration.createLockFile()) {
-                       JOptionPane.showMessageDialog(null, I18n.getMessage("jsite.main.already-running"), null, JOptionPane.ERROR_MESSAGE);
-                       return;
+                       int option = JOptionPane.showOptionDialog(null, I18n.getMessage("jsite.main.already-running"), "", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, new Object[] { I18n.getMessage("jsite.main.already-running.override"), I18n.getMessage("jsite.wizard.quit") }, I18n.getMessage("jsite.wizard.quit"));
+                       if (option != 0) {
+                               return;
+                       }
+                       configuration.removeLockfileOnExit();
                }
                wizard = new TWizard();
                createActions();
@@ -184,6 +193,16 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                                wizard.setNextName(I18n.getMessage("jsite.wizard.next"));
                        }
                };
+               checkForUpdatesAction = new AbstractAction(I18n.getMessage("jsite.menu.help.check-for-updates")) {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @SuppressWarnings("synthetic-access")
+                       public void actionPerformed(ActionEvent actionEvent) {
+                               checkForUpdates();
+                       }
+               };
                aboutAction = new AbstractAction(I18n.getMessage("jsite.menu.help.about")) {
 
                        @SuppressWarnings("synthetic-access")
@@ -366,6 +385,13 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                configuration.setLocale(supportedLocale);
        }
 
+       /**
+        * Checks for updates of jSite.
+        */
+       private void checkForUpdates() {
+
+       }
+
        //
        // INTERFACE ListSelectionListener
        //