Use JDK’s Optional instead of Guava’s
[jSite.git] / src / main / java / de / todesbaum / jsite / gui / ProjectFilesPage.java
index a9c4699..eaae3bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * jSite - ProjectFilesPage.java - Copyright © 2006–2012 David Roden
+ * jSite - ProjectFilesPage.java - Copyright © 2006–2014 David Roden
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -182,8 +182,7 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
        @Override
        public void pageAdded(TWizard wizard) {
                /* create file scanner. */
-               fileScanner = new FileScanner(project);
-               fileScanner.addFileScannerListener(this);
+               fileScanner = new FileScanner(project, this);
 
                actionScan();
                this.wizard.setPreviousName(I18n.getMessage("jsite.wizard.previous"));
@@ -445,7 +444,7 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                                scanningFilesDialog.setVisible(false);
                        }
                }, 2000);
-               new Thread(fileScanner).start();
+               fileScanner.startInBackground();
                new Thread(delayedNotification).start();
                new Thread(new Runnable() {
 
@@ -628,9 +627,9 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis
                        fileOptionsInsertRedirectCheckBox.setSelected(fileOption.isInsertRedirect());
                        fileOptionsCustomKeyTextField.setEnabled(fileOption.isInsertRedirect());
                        fileOptionsCustomKeyTextField.setText(fileOption.getCustomKey());
-                       fileOptionsRenameCheckBox.setSelected(fileOption.hasChangedName());
-                       fileOptionsRenameTextField.setEnabled(fileOption.hasChangedName());
-                       fileOptionsRenameTextField.setText(fileOption.getChangedName());
+                       fileOptionsRenameCheckBox.setSelected(fileOption.getChangedName().isPresent());
+                       fileOptionsRenameTextField.setEnabled(fileOption.getChangedName().isPresent());
+                       fileOptionsRenameTextField.setText(fileOption.getChangedName().orElse(""));
                        fileOptionsMIMETypeComboBox.getModel().setSelectedItem(fileOption.getMimeType());
                } else {
                        defaultFileCheckBox.setSelected(false);