Show error when no files are selected for insertion.
[jSite.git] / src / de / todesbaum / jsite / main / Main.java
index f59e29c..a654c49 100644 (file)
@@ -221,7 +221,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        /**
                         * {@inheritDoc}
                         */
-                       @Override
                        @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
                                optionsPreferences();
@@ -540,13 +539,19 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen
                        }
                        Map<String, FileOption> fileOptions = project.getFileOptions();
                        Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
+                       boolean insert = false;
                        for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
                                FileOption fileOption = fileOptionEntry.getValue();
-                               if (!fileOption.isInsert() && ((fileOption.getCustomKey().length() == 0) || "CHK@".equals(fileOption.getCustomKey()))) {
+                               insert |= fileOption.isInsert() || fileOption.isInsertRedirect();
+                               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;
                                }
                        }
+                       if (!insert) {
+                               JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.no-files-to-insert"), null, JOptionPane.ERROR_MESSAGE);
+                               return;
+                       }
                        boolean nodeRunning = false;
                        try {
                                nodeRunning = freenetInterface.isNodePresent();
@@ -593,6 +598,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);