From: David ‘Bombe’ Roden Date: Thu, 20 Sep 2012 13:11:49 +0000 (+0200) Subject: Add method for quitting jSite, stopping all background services in the process. X-Git-Tag: 0.11^2~10^2~6 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=53484cc24dc6e291cc2d66a71a8c132d38dcbbd3;p=jSite.git Add method for quitting jSite, stopping all background services in the process. --- diff --git a/src/main/java/de/todesbaum/jsite/main/Main.java b/src/main/java/de/todesbaum/jsite/main/Main.java index 1c6e8de..373ac3d 100644 --- a/src/main/java/de/todesbaum/jsite/main/Main.java +++ b/src/main/java/de/todesbaum/jsite/main/Main.java @@ -500,6 +500,15 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen } } + /** + * Quits jSite, stopping all background services. + */ + private void quit() { + updateChecker.stop(); + webOfTrustInterface.stop(); + System.exit(0); + } + // // INTERFACE ListSelectionListener // @@ -627,21 +636,21 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen int overwriteConfigurationAnswer = JOptionPane.showConfirmDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.quit.overwrite-configuration"), configuration.getConfigurationLocator().getFile(configuration.getConfigurationDirectory())), I18n.getMessage("jsite.quit.overwrite-configuration.title"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (overwriteConfigurationAnswer == JOptionPane.YES_OPTION) { if (saveConfiguration()) { - System.exit(0); + quit(); } } else if (overwriteConfigurationAnswer == JOptionPane.CANCEL_OPTION) { return; } if (overwriteConfigurationAnswer == JOptionPane.NO_OPTION) { - System.exit(0); + quit(); } } else { if (saveConfiguration()) { - System.exit(0); + quit(); } } if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.config-not-saved"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.OK_OPTION) { - System.exit(0); + quit(); } } }