Skip to content

Commit

Permalink
Merge branch 'zowe-release/v1.2.0-221' into zowe-release/v1.2.0-223
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Mar 19, 2024
2 parents 876f049 + 0aaabcf commit ff1220d
Show file tree
Hide file tree
Showing 68 changed files with 1,633 additions and 819 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

All notable changes to the Zowe™ Explorer plug-in for IntelliJ IDEA™ will be documented in this file.

## `1.2.0 (2024-xx-yy)`

* Feature: TSO CLI PA1 button functionality added ([48834cac](https://github.com/zowe/zowe-explorer-intellij/commit/48834cac))
* Feature: Allocation units clarification added ([1ff218e4](https://github.com/zowe/zowe-explorer-intellij/commit/1ff218e4))
* Feature: Now after allocating a dataset, a notification is shown instead of a dialog window ([20343651](https://github.com/zowe/zowe-explorer-intellij/commit/20343651))
* Feature: VFS_CHANGES topic rework for encoding purposes ([3adaded3](https://github.com/zowe/zowe-explorer-intellij/commit/3adaded3))
* Feature: Close all files in editor, related to the file/folder/dataset/member being deleted ([8a0d9980](https://github.com/zowe/zowe-explorer-intellij/commit/8a0d9980))


* Bugfix: GitHub issue #159: Zowe config detection doesn't work correctly ([c73226f6](https://github.com/zowe/zowe-explorer-intellij/commit/c73226f6))
* Bugfix: Warning during working set creation without masks/job filters is missing ([4fd0b22c](https://github.com/zowe/zowe-explorer-intellij/commit/4fd0b22c))
* Bugfix: When opened file tabs bar is full, opening any dataset or USS file preserves only last 2 items Explorer items in the bar ([3a822fbb](https://github.com/zowe/zowe-explorer-intellij/commit/3a822fbb))
* Bugfix: Unclear error message for list datasets/jobs when password is expired ([74fe5e86](https://github.com/zowe/zowe-explorer-intellij/commit/74fe5e86))
* Bugfix: In dataset allocation dialog window, dataset name is reset when an error is received ([218f5a3a](https://github.com/zowe/zowe-explorer-intellij/commit/218f5a3a))
* Bugfix: Issue creating member with the same name as the existing one ([6ebae1a0](https://github.com/zowe/zowe-explorer-intellij/commit/6ebae1a0))
* Bugfix: "Overwrite for All" causes caches conflicts when dataset member is being copied to a USS with rewrite ([90b9ce17](https://github.com/zowe/zowe-explorer-intellij/commit/90b9ce17))
* Bugfix: "Cut/Paste" doesn't work when moving a sequential dataset to a partitioned dataset ([f1cf4a9d](https://github.com/zowe/zowe-explorer-intellij/commit/f1cf4a9d))
* Bugfix: Incorrect warning message when uploading a local file to a PDS ([6d9e5de3](https://github.com/zowe/zowe-explorer-intellij/commit/6d9e5de3))
* Bugfix: It is possible to create a dataset when a connection is removed or invalid ([3df02fde](https://github.com/zowe/zowe-explorer-intellij/commit/3df02fde))
* Bugfix: TSO EXEC command without operands causes the CLI to hang ([d071960a](https://github.com/zowe/zowe-explorer-intellij/commit/d071960a))
* Bugfix: Connection is not fully reset to the last successful state and it causes errors ([f6d5a72e](https://github.com/zowe/zowe-explorer-intellij/commit/f6d5a72e))

## `1.1.2 (2024-01-22)`

* Bugfix: Sync action does not work after file download ([bfb125d7](https://github.com/zowe/zowe-explorer-intellij/commit/bfb125d7))
Expand Down
51 changes: 23 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ buildscript {

plugins {
id("org.sonarqube") version "3.3"
id("org.jetbrains.intellij") version "1.14.2"
kotlin("jvm") version "1.8.10"
id("org.jetbrains.intellij") version "1.17.2"
kotlin("jvm") version "1.9.22"
java
id("org.jetbrains.kotlinx.kover") version "0.6.1"
}
Expand All @@ -32,10 +32,10 @@ apply(plugin = "org.jetbrains.intellij")
apply(from = "gradle/sonar.gradle")

group = "org.zowe"
version = "1.1.2-223"
val remoteRobotVersion = "0.11.21"
version = "1.2.0-223"
val remoteRobotVersion = "0.11.22"
val okHttp3Version = "4.12.0"
val kotestVersion = "5.6.2"
val kotestVersion = "5.8.1"

repositories {
mavenCentral()
Expand Down Expand Up @@ -65,23 +65,20 @@ dependencies {
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.retrofit2:converter-scalars:2.9.0")
implementation("com.squareup.okhttp3:okhttp:$okHttp3Version")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.20")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jgrapht:jgrapht-core:1.5.1")
implementation("org.jgrapht:jgrapht-core:1.5.2")
implementation("com.starxg:java-keytar:1.0.0")
implementation("org.zowe.sdk:zowe-kotlin-sdk:0.4.0")
implementation("com.ibm.mq:com.ibm.mq.allclient:9.3.4.1")
testImplementation("io.mockk:mockk:1.13.5")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testImplementation("io.mockk:mockk:1.13.9")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
testImplementation("com.squareup.okhttp3:mockwebserver:$okHttp3Version")
testImplementation("com.squareup.okhttp3:okhttp-tls:$okHttp3Version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.2")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.1")
testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.10.1")
}

intellij {
Expand All @@ -96,6 +93,10 @@ tasks {
}
}

withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

patchPluginXml {
sinceBuild.set("223.7571")
untilBuild.set("223.*")
Expand Down Expand Up @@ -167,6 +168,15 @@ tasks {
dependsOn(createOpenApiSourceJar)
from(createOpenApiSourceJar) { into("lib/src") }
}

downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}

runIdeForUiTests {
systemProperty("idea.trust.all.projects", "true")
systemProperty("ide.show.tips.on.startup.default.value", "false")
}
}

/**
Expand Down Expand Up @@ -256,18 +266,3 @@ val SmokeUiTest = task<Test>("smokeUiTest") {
isDisabled.set(true)
}
}

tasks {
withType<Copy> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}

tasks.downloadRobotServerPlugin {
version.set(remoteRobotVersion)
}

tasks.runIdeForUiTests {
systemProperty("idea.trust.all.projects", "true")
systemProperty("ide.show.tips.on.startup.default.value", "false")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBA Group 2020
*/

package org.zowe.explorer.common

import java.util.*

class SettingsPropertyManager

/**
* Properties from the settings.properties file
*/
internal val settingsProperties by lazy {
Properties().apply {
load(SettingsPropertyManager::class.java.classLoader.getResourceAsStream("settings.properties"))
}
}

/**
* Check if the debug mode is enabled
*/
fun isDebugModeEnabled(): Boolean {
return settingsProperties.getProperty("debug.mode")?.toBoolean() ?: false
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.zowe.explorer.dataops.DataOpsManager
import org.zowe.explorer.dataops.operations.*
import org.zowe.explorer.utils.*
import org.zowe.explorer.utils.crudable.Crudable
import org.zowe.explorer.utils.crudable.find
import org.zowe.explorer.utils.crudable.getAll
import org.zowe.kotlinsdk.ChangePassword
import org.zowe.kotlinsdk.annotations.ZVersion
Expand All @@ -53,7 +54,11 @@ class ConnectionDialog(
* Private field
* In case of DialogMode.UPDATE takes the last successful state from crudable, takes default state otherwise
*/
private val lastSuccessfulState: ConnectionDialogState = if(state.mode == DialogMode.UPDATE) state.connectionConfig.toDialogState(crudable) else ConnectionDialogState()
private val lastSuccessfulState: ConnectionDialogState =
if(state.mode == DialogMode.UPDATE) crudable.find<ConnectionConfig> { it.uuid == state.connectionUuid }
.findAny()
.orElseGet { state.connectionConfig }
.toDialogState(crudable) else ConnectionDialogState()
companion object {

/** Show Test connection dialog and test the connection regarding the dialog state.
Expand Down
17 changes: 17 additions & 0 deletions src/main/kotlin/org/zowe/explorer/config/ws/ui/AbstractWsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ abstract class AbstractWsDialog<Connection : ConnectionConfigBase, WSConfig : Wo
var initialState: WSDState = state.clone(wsdStateClass)
) : DialogWrapper(false), StatefulComponent<WSDState> {

companion object {

// TODO: Remove when it becomes possible to mock class constructor with init section.
/** Wrapper for init() method. It is necessary only for test purposes for now. */
private fun initialize(init: () -> Unit) {
init()
}
}

abstract val wsConfigClass: Class<out WSConfig>
abstract val connectionClass: Class<out Connection>

Expand Down Expand Up @@ -149,6 +158,14 @@ abstract class AbstractWsDialog<Connection : ConnectionConfigBase, WSConfig : Wo
}
}

/** Register validator that enables OK action if validation map is empty */
override fun init() {
initialize { super.init() }
panel.registerValidators(myDisposable) { map ->
isOKActionEnabled = map.isEmpty()
}
}

override fun createCenterPanel(): JComponent {
return panel
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/org/zowe/explorer/dataops/DataOpsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.zowe.explorer.dataops.fetch.FileFetchProvider
import org.zowe.explorer.dataops.log.LogFetcher
import org.zowe.explorer.dataops.log.MFLogger
import org.zowe.explorer.dataops.log.MFProcessInfo
import org.zowe.explorer.dataops.operations.mover.names.CopyPasteNameResolver

interface DataOpsManager : Disposable {

Expand Down Expand Up @@ -65,6 +66,8 @@ interface DataOpsManager : Disposable {

fun getMFContentAdapter(file: VirtualFile): MFContentAdapter

fun getNameResolver(source: VirtualFile, destination: VirtualFile): CopyPasteNameResolver

fun isOperationSupported(operation: Operation<*>): Boolean

@Throws(Throwable::class)
Expand Down
11 changes: 11 additions & 0 deletions src/main/kotlin/org/zowe/explorer/dataops/DataOpsManagerImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import org.zowe.explorer.dataops.log.LogFetcher
import org.zowe.explorer.dataops.log.MFLogger
import org.zowe.explorer.dataops.log.MFProcessInfo
import org.zowe.explorer.dataops.operations.OperationRunner
import org.zowe.explorer.dataops.operations.mover.names.CopyPasteNameResolver
import org.zowe.explorer.dataops.operations.mover.names.DefaultNameResolver
import org.zowe.explorer.utils.associateListedBy
import org.zowe.explorer.utils.findAnyNullable
import org.zowe.explorer.utils.log
Expand Down Expand Up @@ -137,6 +139,15 @@ class DataOpsManagerImpl : DataOpsManager {
}
private val mfContentAdapters by mfContentAdaptersDelegate

private val nameResolversDelegate = lazy {
CopyPasteNameResolver.EP.extensionList.buildComponents()
}
private val nameResolvers by nameResolversDelegate

override fun getNameResolver(source: VirtualFile, destination: VirtualFile): CopyPasteNameResolver {
return nameResolvers.firstOrNull { it.accepts(source, destination) } ?: DefaultNameResolver()
}

/**
* Checks if sync with mainframe is supported for provided object
* @param file object on mainframe that should be checked on availability of synchronization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,10 @@ interface ContentSynchronizer {
*/
fun isFileUploadNeeded(syncProvider: SyncProvider): Boolean

/**
* Marks file as not needed for synchronisation until the next time file is modified.
* @param syncProvider instance of [SyncProvider] class that contains file to mark.
*/
fun markAsNotNeededForSync(syncProvider: SyncProvider)

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.editor.Document
import com.intellij.openapi.editor.impl.DocumentImpl
import com.intellij.openapi.fileEditor.FileDocumentManager
import com.intellij.openapi.util.text.StringUtil
import com.intellij.openapi.util.text.StringUtilRt
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.util.LineSeparator
import org.zowe.explorer.dataops.DataOpsManager
import org.zowe.explorer.dataops.attributes.RemoteUssAttributes
import org.zowe.explorer.editor.DocumentChangeListener
import org.zowe.explorer.utils.castOrNull
import org.zowe.explorer.utils.changeEncodingTo
import org.zowe.explorer.vfs.MFVirtualFile
import java.nio.charset.Charset
import java.util.concurrent.atomic.AtomicBoolean
Expand Down Expand Up @@ -89,39 +91,59 @@ class DocumentedSyncProvider(
override val isReadOnly: Boolean
get() = getDocument()?.isWritable != true

/**
* Initialize the file properties (charset, line separator)
* when the file is opened for the first time.
* @param content bytes of the content to init.
*/
private fun initFileProperties(content: ByteArray) {
val charset = getCurrentCharset()
val text = content.toString(charset)
val detectedLineSeparator = runCatching { StringUtil.detectSeparators(text) }.getOrNull() ?: LineSeparator.LF
file.detectedLineSeparator = detectedLineSeparator.separatorString
changeEncodingTo(file, charset)
}

/**
* Puts initial content in file document.
* @see SyncProvider.putInitialContent
*/
override fun putInitialContent(content: ByteArray) {
if (isInitialContentSet.compareAndSet(false, true)) {
runCatching {
file.getOutputStream(null).use {
it.write(content)
}
initFileProperties(content)
loadNewContent(content)
}.onFailure {
isInitialContentSet.set(false)
}
}
}

/** Checks if the new content needs to be load */
private fun isLoadNeeded(content: ByteArray): Boolean {
val currentContent = retrieveCurrentContent()
return !content.contentEquals(currentContent)
}

/**
* Update content in file document.
* @see SyncProvider.loadNewContent
*/
override fun loadNewContent(content: ByteArray) {
if (!isLoadNeeded(content)) return
val document = getDocument()
document.castOrNull<DocumentImpl>()?.setAcceptSlashR(true)
val wasReadOnly = isReadOnly
if (wasReadOnly) {
document?.setReadOnly(false)
}
val charset = getCurrentCharset()
document?.setText(String(content, charset))
val text = content.toString(charset)
document?.setText(text)
if (wasReadOnly) {
document?.setReadOnly(true)
}
saveDocument()
}

/**
Expand Down
Loading

0 comments on commit ff1220d

Please sign in to comment.