/**
* The main class that ties together everything.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
public class Main implements ActionListener, ListSelectionListener, WizardListener, NodeManagerListener {
/** 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;
/**
* Enumeration for all possible pages.
- *
+ *
* @author David ‘Bombe’ Roden <bombe@freenetproject.org>
*/
private static enum PageType {
/** The “manage nodes” action. */
private Action manageNodeAction;
+ /** The “check for updates” action. */
+ private Action checkForUpdatesAction;
+
/** The “about jSite” action. */
private Action aboutAction;
/**
* Creates a new core with the given configuration from the given file.
- *
+ *
* @param configFilename
* The name of the configuration file
*/
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();
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")
/**
* Creates the menu bar.
- *
+ *
* @return The menu bar
*/
private JMenuBar createMenuBar() {
/**
* Shows the page with the given type.
- *
+ *
* @param pageType
* The page type to show
*/
/**
* Saves the configuration.
- *
+ *
* @return <code>true</code> if the configuration could be saved,
* <code>false</code> otherwise
*/
/**
* Finds a supported locale for the given locale.
- *
+ *
* @param forLocale
* The locale to find a supported locale for
* @return The supported locale that was found, or the default locale if no
/**
* Switches the language of the interface to the given locale.
- *
+ *
* @param locale
* The locale to switch to
*/
configuration.setLocale(supportedLocale);
}
+ /**
+ * Checks for updates of jSite.
+ */
+ private void checkForUpdates() {
+
+ }
+
//
// INTERFACE ListSelectionListener
//
/**
* Main method that is called by the VM.
- *
+ *
* @param args
* The command-line arguments
*/