Implement way to not insert a file at all.
[jSite.git] / src / de / todesbaum / jsite / main / Main.java
index 9f21042..80e0dd0 100644 (file)
@@ -24,8 +24,10 @@ import java.awt.event.ActionListener;
 import java.io.File;
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
@@ -219,7 +221,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        /**
                         * {@inheritDoc}
                         */
-                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                optionsPreferences();
@@ -530,7 +531,8 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                                        return;
                                }
                        }
-                       if (hasIndexFile && !project.getFileOption(indexFile).getMimeType().equals("text/html")) {
+                       List<String> allowedIndexContentTypes = Arrays.asList("text/html", "application/xhtml+xml");
+                       if (hasIndexFile && !allowedIndexContentTypes.contains(project.getFileOption(indexFile).getMimeType())) {
                                if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.project-files.index-not-html"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE) != JOptionPane.OK_OPTION) {
                                        return;
                                }
@@ -539,7 +541,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
                        for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
                                FileOption fileOption = fileOptionEntry.getValue();
-                               if (!fileOption.isInsert() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
+                               if (!fileOption.isInsert() && fileOption.isInsertRedirect() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
                                        JOptionPane.showMessageDialog(wizard, MessageFormat.format(I18n.getMessage("jsite.project-files.no-custom-key"), fileOptionEntry.getKey()), null, JOptionPane.ERROR_MESSAGE);
                                        return;
                                }
@@ -590,6 +592,9 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
         * {@inheritDoc}
         */
        public void wizardQuitPressed(TWizard wizard) {
+               if (((ProjectPage) pages.get(PageType.PAGE_PROJECTS)).wasUriCopied() || ((ProjectInsertPage) pages.get(PageType.PAGE_INSERT_PROJECT)).wasUriCopied()) {
+                       JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project.warning.use-clipboard-now"));
+               }
                if (JOptionPane.showConfirmDialog(wizard, I18n.getMessage("jsite.quit.question"), null, JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.OK_OPTION) {
                        if (saveConfiguration()) {
                                System.exit(0);