- 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;
- }
- }
- 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;
- }
- }
- Map<String, FileOption> fileOptions = project.getFileOptions();
- Set<Entry<String, FileOption>> fileOptionEntries = fileOptions.entrySet();
- boolean insert = false;
- for (Entry<String, FileOption> fileOptionEntry : fileOptionEntries) {
- String fileName = fileOptionEntry.getKey();
- FileOption fileOption = fileOptionEntry.getValue();
- insert |= fileOption.isInsert() || fileOption.isInsertRedirect();
- if (fileName.equals(project.getIndexFile()) && !fileOption.isInsert() && !fileOption.isInsertRedirect()) {
- JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.index-not-inserted"), null, JOptionPane.ERROR_MESSAGE);
- return;
- }
- 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;
- }