Skip to content

Commit 3b390ab

Browse files
authored
Merge pull request #530 from digital-preservation/DR2-2052-File-open-dialog-for-CSV-and-CSVS-files-have-become-multiselect-when-run-on-java-21
Dr2 2052 file open dialog for csv and csvs files have become multiselect when run on java 21
2 parents 72fdc31 + 9a4a563 commit 3b390ab

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

csv-validator-ui/src/main/scala/uk/gov/nationalarchives/csv/validator/ui/CsvValidatorUi.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ object CsvValidatorUi extends SimpleSwingApplication {
100100
}
101101

102102
private def extractFromManifest[T](extractor: Attributes => T): Option[T] = {
103-
val clazz = getClass()
103+
val clazz = getClass
104104
val className = clazz.getSimpleName + ".class"
105-
val classPath = clazz.getResource(className).toString()
105+
val classPath = clazz.getResource(className).toString
106106
if (!classPath.startsWith("jar")) {
107107
None // Class not from JAR
108108
} else {
@@ -301,6 +301,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
301301
}
302302

303303
private val csvFileChooser = new FileChooser(lastCsvPath)
304+
csvFileChooser.multiSelectionEnabled = false
304305
csvFileChooser.title = "Select a .csv file"
305306
csvFileChooser.fileFilter = new FileNameExtensionFilter("CSV file (*.csv)", "csv")
306307
private val btnChooseCsvFile = new Button("...")
@@ -317,6 +318,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
317318

318319
txtCsvSchemaFile.setTransferHandler(fileHandler)
319320
private val csvSchemaFileChooser = new FileChooser(lastCsvPath)
321+
csvSchemaFileChooser.multiSelectionEnabled = false
320322
csvSchemaFileChooser.title = "Select a .csvs file"
321323
csvSchemaFileChooser.fileFilter = new FileNameExtensionFilter("CSV Schema file (*.csvs)", "csvs" +
322324
"")
@@ -414,6 +416,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
414416
btnClose.reactions += onClick(quit())
415417

416418
private val reportFileChooser = new FileChooser(lastCsvPath)
419+
reportFileChooser.multiSelectionEnabled = false
417420
val dateFormat = new SimpleDateFormat("dd-mm-yy_HH-mm-ss")
418421
reportFileChooser.selectedFile = new File(s"csv_validator_report_${dateFormat.format(new Date())}.txt")
419422

@@ -517,6 +520,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
517520
val fromFolderName = Path.of(fromPathField.text).getFileName
518521
val helpText = s"Select the ${fromFolderName} folder"
519522
val fileChooser = new FileChooser(startingDir)
523+
fileChooser.multiSelectionEnabled = false
520524
fileChooser.title = helpText
521525
fileChooser.fileSelectionMode = SelectionMode.DirectoriesOnly
522526
chooseFileOrDir(fileChooser, f => updateFileText(f), fileButton, helpText)
@@ -542,7 +546,7 @@ object CsvValidatorUi extends SimpleSwingApplication {
542546
}
543547

544548
def pathSubstitutions : List[(String, String)] = {
545-
for(rowIdx <- (0 to model.getRowCount - 1)) yield (model.getValueAt(rowIdx, 0).asInstanceOf[String], model.getValueAt(rowIdx, 1).asInstanceOf[String])
549+
for(rowIdx <- 0 to model.getRowCount - 1) yield (model.getValueAt(rowIdx, 0).asInstanceOf[String], model.getValueAt(rowIdx, 1).asInstanceOf[String])
546550
}.toList
547551
}
548552

0 commit comments

Comments
 (0)