Export Result and Save Backup handle no file selection (#3370)

* Export Result and Save Backup handle no file selection, New Point in curve not marked Endpoint

* Revert endpoint defaullt change

* Change to Option[File] from Save Dialog

* Explicit no return from cases
This commit is contained in:
user411 2021-07-07 14:35:11 -06:00 committed by GitHub
parent bc79a24f53
commit bb838624ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -34,10 +34,14 @@ private class FileMenu() {
initialDirectory = new File(Properties.userHome)
initialFileName = "bitcoin-s-backup.zip"
}
val chosenFile = fileChooser.showSaveDialog(null)
ConsoleCli.exec(ZipDataDir(chosenFile.toPath),
GlobalData.consoleCliConfig)
()
val chosenFileOpt = Option(fileChooser.showSaveDialog(null))
chosenFileOpt match {
case Some(chosenFile) =>
ConsoleCli.exec(ZipDataDir(chosenFile.toPath),
GlobalData.consoleCliConfig)
()
case None => // User canceled in dialog
}
}
}

View File

@ -124,9 +124,13 @@ class DLCPane(glassPane: VBox)(implicit ec: ExecutionContext) {
selectedExtensionFilter = txtExtensionFilter
initialDirectory = new File(Properties.userHome)
}
val chosenFile = fileChooser.showSaveDialog(null)
Files.write(chosenFile.toPath, resultTextArea.text.value.getBytes)
()
val chosenFileOpt = Option(fileChooser.showSaveDialog(null))
chosenFileOpt match {
case Some(chosenFile) =>
Files.write(chosenFile.toPath, resultTextArea.text.value.getBytes)
()
case None => // User canceled in dialog
}
}
}