+ def save {
+ if (reportSet.file.isEmpty) {
+ val chooser = new FileChooser(Preferences.lastChosenDir())
+ val r = chooser.showSaveDialog(null)
+ if (r != FileChooser.Result.Approve) {
+ return
+ }
+
+ if (chooser.selectedFile.exists) {
+ val r = JOptionPane.showConfirmDialog(
+ peer,
+ "The chosen file or directory \"" + chooser.selectedFile.getName + "\" already exists.\n" +
+ "Do you want to overwrite it?",
+ "Confirmation",
+ JOptionPane.YES_NO_OPTION)
+
+ r match {
+ case JOptionPane.YES_OPTION =>
+ case JOptionPane.NO_OPTION => return
+ }
+ }
+
+ Preferences.lastChosenDir() = chooser.selectedFile.getParentFile
+ reportSet.file = Some(chooser.selectedFile)
+ }
+
+ reportSet.save
+ }
+