X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fmain%2FMain.java;h=005fc376ff31c1e35d813da96ef8134bec876be9;hb=40b5aaed8248884fd3ed7c6797296604fc7dce94;hp=bfb5ef35b89f5a38f6ca4072465260a0618ecb4d;hpb=7a7dfd4c7096794e36c4e6d70792328e713bdd95;p=jSite.git diff --git a/src/de/todesbaum/jsite/main/Main.java b/src/de/todesbaum/jsite/main/Main.java index bfb5ef3..005fc37 100644 --- a/src/de/todesbaum/jsite/main/Main.java +++ b/src/de/todesbaum/jsite/main/Main.java @@ -21,6 +21,7 @@ package de.todesbaum.jsite.main; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; import java.io.IOException; import java.text.MessageFormat; import java.util.HashMap; @@ -73,7 +74,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen PAGE_NODE_MANAGER, PAGE_PROJECTS, PAGE_PROJECT_FILES, PAGE_INSERT_PROJECT } - private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH }; + private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH, Locale.ITALIAN }; protected Map languageActions = new HashMap(); protected Action manageNodeAction; protected Action aboutAction; @@ -85,7 +86,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen private Main() { this(null); } - + private Main(String configFilename) { if (configFilename != null) { configuration = new Configuration(configFilename); @@ -134,7 +135,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.about.message"), Version.getVersion()), null, JOptionPane.INFORMATION_MESSAGE, jSiteIcon); } }; - + I18nContainer.getInstance().registerRunnable(new Runnable() { public void run() { manageNodeAction.putValue(Action.NAME, I18n.getMessage("jsite.menu.nodes.manage-nodes")); @@ -171,7 +172,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen final JMenu helpMenu = new JMenu(I18n.getMessage("jsite.menu.help")); menuBar.add(helpMenu); helpMenu.add(aboutAction); - + I18nContainer.getInstance().registerRunnable(new Runnable() { public void run() { languageMenu.setText(I18n.getMessage("jsite.menu.languages")); @@ -182,7 +183,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen } } }); - + return menuBar; } @@ -320,13 +321,21 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.empty-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) { return; } + } else { + File indexFile = new File(project.getLocalPath(), project.getIndexFile()); + if (!indexFile.exists()) { + JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.index-missing"), null, JOptionPane.ERROR_MESSAGE); + return; + } } - if (!project.getFileOption(project.getIndexFile()).getContainer().equals("")) { + String indexFile = project.getIndexFile(); + boolean hasIndexFile = (indexFile != null); + if (hasIndexFile && !project.getFileOption(indexFile).getContainer().equals("")) { if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.container-index"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) { return; } } - if (!project.getFileOption(project.getIndexFile()).getMimeType().equals("text/html")) { + if (hasIndexFile && !project.getFileOption(indexFile).getMimeType().equals("text/html")) { if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.index-not-html"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) { return; } @@ -460,5 +469,5 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen System.out.println("--debug\tenables some debug output"); System.out.println("--config-file \tuse specified configuration file"); } - + }