@@ -309,7 +309,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
309309
310310 btnChooseCsvFile.reactions += onClick {
311311 setPathToLastCsvPath(csvFileChooser)
312- chooseFile (csvFileChooser, txtCsvFile, btnChooseCsvFile)
312+ chooseFileOrDir (csvFileChooser, txtCsvFile, btnChooseCsvFile)
313313 updateLastPath(csvFileChooser, path => Settings (path, path, path))
314314 }
315315
@@ -324,7 +324,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
324324 private val btnChooseCsvSchemaFile = new Button (" ..." )
325325 btnChooseCsvSchemaFile.reactions += onClick {
326326 setPathToLastCsvPath(csvSchemaFileChooser)
327- chooseFile (csvSchemaFileChooser, txtCsvSchemaFile, btnChooseCsvSchemaFile)
327+ chooseFileOrDir (csvSchemaFileChooser, txtCsvSchemaFile, btnChooseCsvSchemaFile)
328328 updateLastPath(csvSchemaFileChooser, path => Settings (path, path, path))
329329 }
330330
@@ -497,34 +497,34 @@ object CsvValidatorUi extends SimpleSwingApplication {
497497 val identifierRows = CsvValidatorCmdApp .getColumnFromCsv(csvFile, schemaFile, " identifier" ).sorted
498498 val fromPath = identifierRows.headOption.getOrElse(" " )
499499
500- val fileTextField = new TextField (30 )
501- val fromPathText = new TextField (fromPath, 30 )
500+ val toPathField = new TextField (30 )
501+ val fromPathField = new TextField (fromPath, 30 )
502502
503503 def pathToUri (path : Path ) = {
504504 val uri = path.toUri.toString
505505 if (uri.endsWith(" /" )) uri else s " $uri/ "
506506 }
507507
508508 def updateFileText (path : Path ): Try [String ] = {
509- fileTextField .text = pathToUri(path)
509+ toPathField .text = pathToUri(path)
510510 Success (" Text updated" )
511511 }
512512
513- val okButton = new Button (" OK" )
514513 val fileButton = new Button (" ..." )
515514 fileButton.reactions += {
516515 case ev : ButtonClicked =>
517- val startingDir = if (fileTextField.text.isEmpty) userDir.toFile else Path .of(fileTextField.text).toFile
518- val helpText = s " Select the ${fromPath.split(" /" ).last} folder "
516+ val startingDir = if (toPathField.text.isEmpty) userDir.toFile else Path .of(toPathField.text).toFile
517+ val fromFolderName = Path .of(fromPathField.text).getFileName
518+ val helpText = s " Select the ${fromFolderName} folder "
519519 val fileChooser = new FileChooser (startingDir)
520520 fileChooser.title = helpText
521- fileChooser.fileSelectionMode = SelectionMode .FilesAndDirectories
522- chooseFile (fileChooser, f => updateFileText(f), fileButton, helpText)
521+ fileChooser.fileSelectionMode = SelectionMode .DirectoriesOnly
522+ chooseFileOrDir (fileChooser, f => updateFileText(f), fileButton, helpText)
523523 }
524524
525525 val rows = List (
526- Row (" From" , List (fromPathText )),
527- Row (" To" , List (fileTextField , fileButton))
526+ Row (" From" , List (fromPathField )),
527+ Row (" To" , List (toPathField , fileButton))
528528 )
529529 addToTableDialog(parentFrame, " Add Path Substitution..." , rows, tblPathSubstitutions.addRow)
530530 }
0 commit comments