diff --git a/src/main/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProvider.kt b/src/main/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProvider.kt index 2ee67229..8942af15 100644 --- a/src/main/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProvider.kt +++ b/src/main/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProvider.kt @@ -324,7 +324,7 @@ class ExplorerPasteProvider : PasteProvider { // conflicts end // specific configs resolution - val ussToPdsWarnings = pasteDestinations + val ussOrLocalFileToPdsWarnings = pasteDestinations .mapNotNull { destFile -> val destAttributes = dataOpsManager.tryToGetAttributes(destFile) if (destAttributes !is RemoteDatasetAttributes) null @@ -332,27 +332,28 @@ class ExplorerPasteProvider : PasteProvider { val sourceUssAttributes = sourceFiles .filter { sourceFile -> val sourceAttributes = dataOpsManager.tryToGetAttributes(sourceFile) - sourceAttributes is RemoteUssAttributes || sourceFile is VirtualFileImpl + sourceAttributes is RemoteUssAttributes || sourceFile.isInLocalFileSystem } sourceUssAttributes.map { Pair(destFile, it) }.ifEmpty { null } } } .flatten() - if ( - ussToPdsWarnings.isNotEmpty() && - !showYesNoDialog( - "USS File To PDS Placing", - "You are about to place USS file to PDS. All lines exceeding the record length will be truncated.", - null, - "Ok", - "Skip This Files", - AllIcons.General.WarningDialog - ) - ) { - conflictsResolutions.addAll( - ussToPdsWarnings.map { ConflictResolution(it.second, it.first).apply { resolveBySkip() } } - ) + if (ussOrLocalFileToPdsWarnings.isNotEmpty()) { + val isLocalFilesPresent = ussOrLocalFileToPdsWarnings.find { it.second.isInLocalFileSystem } != null + val fileTypesPattern = if (isLocalFilesPresent) "Local Files" else "USS Files" + if (!showYesNoDialog( + "$fileTypesPattern to PDS Placing", + "You are about to place $fileTypesPattern to PDS. All lines exceeding the record length will be truncated.", + null, + "Ok", + "Skip This Files", + AllIcons.General.WarningDialog + )) { + conflictsResolutions.addAll( + ussOrLocalFileToPdsWarnings.map { ConflictResolution(it.second, it.first).apply { resolveBySkip() } } + ) + } } // specific conflicts resolution end diff --git a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt index 24066234..369d8124 100644 --- a/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt +++ b/src/test/kotlin/eu/ibagroup/formainframe/explorer/ui/ExplorerPasteProviderTestSpec.kt @@ -299,6 +299,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({ every { mockedSourceAttributes.isDirectory } returns false every { mockedSourceNodeData.node } returns mockedSourceNode every { mockedSourceNodeData.file } returns mockedSourceFile + every { mockedSourceFile.isInLocalFileSystem } returns false every { mockedSourceNodeData.attributes } returns mockedSourceAttributes // children of target @@ -394,6 +395,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({ val mockedSourceFile = mockk() val mockedSourceAttributes = mockk() every { mockedSourceFile.name } returns "TEST.FILE" + every { mockedSourceFile.isInLocalFileSystem } returns false every { mockedSourceAttributes.name } returns "TEST.FILE" every { mockedSourceAttributes.isPastePossible } returns false every { mockedSourceAttributes.isDirectory } returns false @@ -1251,6 +1253,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({ every { mockedSourceFile.name } returns fileName every { mockedSourceFile.isDirectory } returns isDirectory every { mockedSourceFile.parent } returns parent + every { mockedSourceFile.isInLocalFileSystem } returns false val mockedSourceAttributes = if (sourceAttributes != null) { sourceAttributes