Implement warning for non-specified index file.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 13 Nov 2008 23:18:19 +0000 (00:18 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 13 Nov 2008 23:18:19 +0000 (00:18 +0100)
Don’t check for existence of index file if none has been specified.

src/net/pterodactylus/jsite/gui/FileManager.java

index 1d81bd8..953e05d 100644 (file)
@@ -256,16 +256,19 @@ public class FileManager extends JDialog implements I18nable, TreeSelectionListe
                        public void actionPerformed(ActionEvent e) {
                                String defaultFile = project.getDefaultFile();
                                if ((defaultFile == null) || (defaultFile.length() == 0)) {
-                                       /* TODO - i18n */
-                                       JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE);
-                                       return;
-                               }
-                               ProjectFile projectFile = project.getFile(defaultFile);
-                               if (projectFile == null) {
-                                       JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE);
-                                       return;
+                                       int selectedOption = JOptionPane.showOptionDialog(FileManager.this, I18n.get("fileManager.dialog.noDefaultFileSet.message"), I18n.get("fileManager.dialog.noDefaultFileSet.title"), 0, JOptionPane.WARNING_MESSAGE, null, new String[] { I18n.get("general.button.continue.name"), I18n.get("general.button.cancel.name") }, I18n.get("general.button.cancel.name"));
+                                       if (selectedOption == 1) {
+                                               return;
+                                       }
+                               } else {
+                                       ProjectFile projectFile = project.getFile(defaultFile);
+                                       if (projectFile == null) {
+                                               /* TODO - i18n */
+                                               JOptionPane.showMessageDialog(FileManager.this, I18n.get(""), I18n.get(""), JOptionPane.ERROR_MESSAGE);
+                                               return;
+                                       }
+                                       setVisible(false);
                                }
-                               setVisible(false);
                        }
                };
                rescanAction = new I18nAction("fileManager.button.rescan") {