files = getProjectFiles();
- for (String filename: files) {
+ for (String filename : files) {
FileOption fileOption = project.getFileOption(filename);
if (fileOption.getContainer().equals(containerName)) {
fileOption.setContainer("");
@@ -340,30 +480,41 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
}
}
+ /**
+ * {@inheritDoc}
+ *
+ * Updates the file list.
+ */
public void fileScannerFinished(FileScanner fileScanner) {
final boolean error = fileScanner.isError();
if (!error) {
final List files = fileScanner.getFiles();
SwingUtilities.invokeLater(new Runnable() {
+ @SuppressWarnings("synthetic-access")
public void run() {
projectFileList.setListData(files.toArray(new String[files.size()]));
projectFileList.clearSelection();
rebuildContainerComboBox();
}
});
+ Set entriesToRemove = new HashSet();
Iterator filenames = project.getFileOptions().keySet().iterator();
while (filenames.hasNext()) {
String filename = filenames.next();
if (!files.contains(filename)) {
- project.setFileOption(filename, null);
+ entriesToRemove.add(filename);
}
}
+ for (String filename : entriesToRemove) {
+ project.setFileOption(filename, null);
+ }
} else {
JOptionPane.showMessageDialog(wizard, I18n.getMessage("jsite.project-files.scan-error"), null, JOptionPane.ERROR_MESSAGE);
}
SwingUtilities.invokeLater(new Runnable() {
+ @SuppressWarnings("synthetic-access")
public void run() {
wizard.setPreviousEnabled(true);
wizard.setNextEnabled(!error);
@@ -468,6 +619,13 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
// INTERFACE DocumentListener
//
+ /**
+ * Updates the options of the currently selected file with the changes made
+ * in the âcustom keyâ textfield.
+ *
+ * @param documentEvent
+ * The document event to process
+ */
private void processDocumentUpdate(DocumentEvent documentEvent) {
String filename = (String) projectFileList.getSelectedValue();
if (filename == null) {
@@ -479,6 +637,7 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
String text = document.getText(0, document.getLength());
fileOption.setCustomKey(text);
} catch (BadLocationException ble1) {
+ /* ignore. */
}
}