Skip to content

Commit

Permalink
Merge branch 'private-release/v2.0.0' into zowe-release/v2.0.0
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Aug 28, 2024
2 parents 5eeac23 + 2869149 commit 7a186bb
Show file tree
Hide file tree
Showing 44 changed files with 2,870 additions and 562 deletions.
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

## [1.2.2-223] (2024-08-21)
## [Unreleased]

### Features
* Feature: GitHub issue #119: Space units are clarified with a hint ([451f3528](https://github.com/zowe/zowe-explorer-intellij/commit/451f3528))
Expand Down Expand Up @@ -36,6 +36,28 @@ All notable changes to the Zowe™ Explorer plug-in for IntelliJ IDEA™ will be
* Bugfix: Owner is now recognized correctly ([08355c8c](https://github.com/zowe/zowe-explorer-intellij/commit/08355c8c))
* Bugfix: USS files are no more displayed after they are deleted ([c130ea52](https://github.com/zowe/zowe-explorer-intellij/commit/c130ea52))
* Bugfix: Files with long name placing as a z/OS dataset is fixed ([1afd501e](https://github.com/zowe/zowe-explorer-intellij/commit/1afd501e))
* Bugfix: Fixed source file removal when cut is performed ([c1b88348](https://github.com/zowe/zowe-explorer-intellij/commit/c1b88348))

## [1.2.2-231] (2024-08-21)

### Features

* Feature: Removed "openApiUtils" functions that were duplicating the ones already implemented in IntelliJ IDEA platform ([fbf7db62](https://github.com/zowe/zowe-explorer-intellij/commit/fbf7db62))

### Bugfixes

* Bugfix: Fixed "/" and "/u" is not displayed correctly in USS Explorer ([547b9678](https://github.com/zowe/zowe-explorer-intellij/commit/547b9678))
* Bugfix: "UTF-16" encoding is now either LE or BE available only ([f4b7e9de](https://github.com/zowe/zowe-explorer-intellij/commit/f4b7e9de))
* Bugfix: The possibility to delete unrelated selected entities is disabled ([f7f9f019](https://github.com/zowe/zowe-explorer-intellij/commit/f7f9f019))
* Bugfix: Fixed cross-system copy-paste for Sequential to PDS ([fb1943e3](https://github.com/zowe/zowe-explorer-intellij/commit/fb1943e3))
* Bugfix: Fixed file permissions change is not reset after failure ([0ce02146](https://github.com/zowe/zowe-explorer-intellij/commit/0ce02146))
* Bugfix: Fixed error notification displayed on uploading USS file ([b84c8beb](https://github.com/zowe/zowe-explorer-intellij/commit/b84c8beb))
* Bugfix: Fixed colouring of entity when it was cut but the operation is changed to download ([3cdb982f](https://github.com/zowe/zowe-explorer-intellij/commit/3cdb982f))
* Bugfix: Fixed folder copying when both parent and child directories are selected ([d8a44d98](https://github.com/zowe/zowe-explorer-intellij/commit/d8a44d98))
* Bugfix: Fixed "Decide for Each -> Skip" option on Cut/Copy ([70089fcc](https://github.com/zowe/zowe-explorer-intellij/commit/70089fcc))
* Bugfix: Fixed rename of datasets was saving names in lowercase in local cache ([18ebcee2](https://github.com/zowe/zowe-explorer-intellij/commit/18ebcee2))
* Bugfix: Fixed downloading of USS files when there are conflicts on a local machine ([ccb48dda](https://github.com/zowe/zowe-explorer-intellij/commit/ccb48dda))
* Bugfix: Fixed copying folder with contents not displaying the contents right after it is copied ([82c7b7a6](https://github.com/zowe/zowe-explorer-intellij/commit/82c7b7a6))

## [1.2.1-231] (2024-06-12)

Expand Down Expand Up @@ -521,7 +543,7 @@ All notable changes to the Zowe™ Explorer plug-in for IntelliJ IDEA™ will be
* Bugfix: GitHub issue #85: The windows 'Add Working Set'/'Edit Working Set' are automatically resized if z/OSMF
connection with very long name is added

[1.2.2-223]: https://github.com/zowe/zowe-explorer-intellij/compare/1.2.1-223...1.2.2-223
[1.2.2-231]: https://github.com/zowe/zowe-explorer-intellij/compare/1.2.1-231...1.2.2-231
[1.2.1-231]: https://github.com/zowe/zowe-explorer-intellij/compare/1.2.0-231...1.2.1-231
[1.2.0-231]: https://github.com/zowe/zowe-explorer-intellij/compare/1.1.2-231...1.2.0-231
[1.1.2-231]: https://github.com/zowe/zowe-explorer-intellij/compare/1.1.1-231...1.1.2-231
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/org/zowe/explorer/config/ConfigSandbox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package org.zowe.explorer.config

import com.intellij.openapi.application.ApplicationManager
import org.zowe.explorer.config.connect.ConnectionConfig
import org.zowe.explorer.tso.config.TSOSessionConfig
import org.zowe.explorer.config.ws.FilesWorkingSetConfig
import org.zowe.explorer.config.ws.JesWorkingSetConfig
import org.zowe.explorer.utils.crudable.Crudable
Expand Down Expand Up @@ -62,7 +63,8 @@ interface ConfigSandbox {
entities = [
FilesWorkingSetConfig::class,
ConnectionConfig::class,
JesWorkingSetConfig::class
JesWorkingSetConfig::class,
TSOSessionConfig::class
]
)
val crudable: Crudable
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/org/zowe/explorer/config/ConfigService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.util.messages.Topic
import org.zowe.explorer.config.connect.ConnectionConfig
import org.zowe.explorer.tso.config.TSOSessionConfig
import org.zowe.explorer.config.ws.FilesWorkingSetConfig
import org.zowe.explorer.config.ws.JesWorkingSetConfig
import org.zowe.explorer.utils.crudable.Crudable
Expand All @@ -40,7 +41,8 @@ interface ConfigService : PersistentStateComponent<ConfigStateV2> {
entities = [
FilesWorkingSetConfig::class,
ConnectionConfig::class,
JesWorkingSetConfig::class
JesWorkingSetConfig::class,
TSOSessionConfig::class
]
)
val crudable: Crudable
Expand Down
20 changes: 12 additions & 8 deletions src/main/kotlin/org/zowe/explorer/config/connect/connectUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
import org.zowe.explorer.api.api
import org.zowe.explorer.config.connect.ui.zosmf.ConnectionDialog
import org.zowe.explorer.tso.config.ui.TSOSessionDialogState
import org.zowe.explorer.dataops.DataOpsManager
import org.zowe.explorer.dataops.operations.*
import org.zowe.explorer.dataops.operations.MessageData
import org.zowe.explorer.dataops.operations.MessageType
import org.zowe.explorer.dataops.operations.TsoOperation
import org.zowe.explorer.dataops.operations.TsoOperationMode
import org.zowe.explorer.ui.build.tso.TSOWindowFactory
import org.zowe.explorer.ui.build.tso.config.TSOConfigWrapper
import org.zowe.explorer.ui.build.tso.ui.TSOSessionParams
import org.zowe.explorer.tso.TSOWindowFactory
import org.zowe.explorer.tso.config.TSOConfigWrapper
import org.zowe.kotlinsdk.TsoData
import org.zowe.kotlinsdk.*
import org.zowe.kotlinsdk.annotations.ZVersion

Expand All @@ -35,17 +35,21 @@ val LOGGER = logger<ConnectionDialog>()
*/
fun whoAmI(connectionConfig: ConnectionConfig): String? {
val zVersion = connectionConfig.zVersion
val tsoSessionParams = TSOSessionParams(connectionConfig)
var owner: String? = null
if (zVersion < ZVersion.ZOS_2_4) {
val state = TSOSessionDialogState()
state.connectionConfigUuid = connectionConfig.uuid
val emptyOwner = ""
val queuedMessages: MutableList<TsoData> = mutableListOf()
runCatching {
val tsoStartResponse = service<DataOpsManager>().performOperation(
TsoOperation(tsoSessionParams, TsoOperationMode.START)
TsoOperation(
TSOConfigWrapper(state.tsoSessionConfig, connectionConfig),
TsoOperationMode.START
)
)
if (tsoStartResponse.servletKey?.isNotEmpty() == true) {
val tsoSession = TSOConfigWrapper(tsoSessionParams, tsoStartResponse)
val tsoSession = TSOConfigWrapper(state.tsoSessionConfig, connectionConfig, tsoStartResponse)
while (tsoSession.getTSOResponseMessageQueue().last().tsoPrompt == null) {
val response = TSOWindowFactory.getTsoMessageQueue(tsoSession)
tsoSession.setTSOResponseMessageQueue(response.tsoData)
Expand Down
15 changes: 3 additions & 12 deletions src/main/kotlin/org/zowe/explorer/config/ws/ui/AbstractWsDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@ import org.zowe.explorer.common.ui.tableWithToolbar
import org.zowe.explorer.config.connect.ConnectionConfig
import org.zowe.explorer.config.connect.ConnectionConfigBase
import org.zowe.explorer.config.ws.WorkingSetConfig
import org.zowe.explorer.utils.clone
import org.zowe.explorer.utils.*
import org.zowe.explorer.utils.crudable.Crudable
import org.zowe.explorer.utils.nullable
import org.zowe.explorer.utils.validateForBlank
import org.zowe.explorer.utils.validateWorkingSetName
import java.awt.Dimension
import javax.swing.JComponent

Expand Down Expand Up @@ -96,7 +93,7 @@ abstract class AbstractWsDialog<Connection : ConnectionConfigBase, WSConfig : Wo
* @return applied state.
*/
open fun onWSApplied(state: WSDState): WSDState = state

private val panel by lazy {
panel {
row {
Expand Down Expand Up @@ -141,13 +138,7 @@ abstract class AbstractWsDialog<Connection : ConnectionConfigBase, WSConfig : Wo
state.connectionUuid = (selectedItem as ConnectionConfig).uuid
}
}
.validationOnApply {
if (it.selectedItem == null) {
ValidationInfo("You must provide a connection", it)
} else {
null
}
}
.validationOnApply { validateConnectionSelection(it) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import org.zowe.explorer.api.api
import org.zowe.explorer.config.connect.authToken
import org.zowe.explorer.dataops.DataOpsManager
import org.zowe.explorer.dataops.exceptions.CallException
import org.zowe.explorer.ui.build.tso.config.TSOConfigWrapper
import org.zowe.explorer.ui.build.tso.ui.TSOSessionParams
import org.zowe.explorer.tso.config.TSOConfigWrapper
import org.zowe.explorer.utils.cancelByIndicator
import org.zowe.explorer.utils.log
import org.zowe.explorer.dataops.operations.MessageType as MessageTypeEnum
Expand Down Expand Up @@ -60,18 +59,19 @@ class TsoOperationRunner : OperationRunner<TsoOperation, TsoResponse> {
var response: Response<TsoResponse>? = null
when (mode) {
TsoOperationMode.START -> {
val state = operation.state as TSOSessionParams
response = api<TsoApi>(state.connectionConfig)
val state = operation.state as TSOConfigWrapper
val tsoSessionConfig = state.getTSOSessionConfig()
response = api<TsoApi>(state.getConnectionConfig())
.startTso(
state.connectionConfig.authToken,
proc = state.logonproc.toUpperCasePreservingASCIIRules(),
chset = state.charset,
cpage = state.codepage.toString(),
rows = state.rows.toInt(),
cols = state.cols.toInt(),
acct = state.acct.toUpperCasePreservingASCIIRules(),
ugrp = state.usergroup.toUpperCasePreservingASCIIRules(),
rsize = state.region.toInt()
state.getConnectionConfig().authToken,
proc = tsoSessionConfig.logonProcedure.toUpperCasePreservingASCIIRules(),
chset = tsoSessionConfig.charset,
cpage = tsoSessionConfig.codepage.toString(),
rows = tsoSessionConfig.rows,
cols = tsoSessionConfig.columns,
acct = tsoSessionConfig.accountNumber?.toUpperCasePreservingASCIIRules(),
ugrp = tsoSessionConfig.userGroup?.toUpperCasePreservingASCIIRules(),
rsize = tsoSessionConfig.regionSize
)
.cancelByIndicator(progressIndicator)
.execute()
Expand Down Expand Up @@ -124,8 +124,15 @@ class TsoOperationRunner : OperationRunner<TsoOperation, TsoResponse> {
val body = response.body()
if (body != null) {
if (!response.isSuccessful || body.msgData.isNotEmpty()) {
val errorMsg = body.msgData.toString()
throw CallException(response, errorMsg)
var errorMsg = ""
for (msg in body.msgData) {
errorMsg += msg.messageText + "\n"
}
if (errorMsg.isNotEmpty()) {
throw Exception(errorMsg)
} else {
throw CallException(response, response.message())
}
}
} else {
throw CallException(response, response.message())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@ import org.zowe.explorer.dataops.content.synchronizer.DEFAULT_TEXT_CHARSET
import org.zowe.explorer.dataops.content.synchronizer.DocumentedSyncProvider
import org.zowe.explorer.dataops.content.synchronizer.addNewLine
import org.zowe.explorer.dataops.exceptions.CallException
import org.zowe.explorer.dataops.operations.DeleteOperation
import org.zowe.explorer.dataops.operations.OperationRunner
import org.zowe.explorer.dataops.operations.OperationRunnerFactory
import org.zowe.explorer.utils.applyIfNotNull
import org.zowe.explorer.utils.cancelByIndicator
import org.zowe.explorer.utils.castOrNull
import org.zowe.explorer.utils.log
import org.zowe.explorer.utils.runWriteActionInEdtAndWait
import org.zowe.explorer.utils.*
import org.zowe.explorer.vfs.MFVirtualFile
import org.zowe.kotlinsdk.DataAPI
import org.zowe.kotlinsdk.XIBMDataType
Expand Down Expand Up @@ -123,6 +120,27 @@ class CrossSystemMemberOrUssFileToPdsMover(val dataOpsManager: DataOpsManager) :
contentSynchronizer.synchronizeWithRemote(syncProvider, progressIndicator)
}
}
if (operation.isMove) {
log.info("Trying to delete source file")
val sourceAttributes = operation.sourceAttributes
runCatching {
if (sourceAttributes != null) {
dataOpsManager.performOperation(DeleteOperation(operation.source, sourceAttributes))
}
}
.onFailure { t ->
log.warn("Can't delete source file $sourceFile")
val rollbackResponse = apiWithBytesConverter<DataAPI>(destConnectionConfig).deleteDatasetMember(
authorizationToken = destConnectionConfig.authToken,
datasetName = destAttributes.name,
memberName = memberName
).execute()
if (!rollbackResponse.isSuccessful) {
log.warn("Cannot delete ${destAttributes.name}. Rollback failed.")
}
throwable = t
}
}
}

return throwable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ package org.zowe.explorer.explorer
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionToolbar
import com.intellij.openapi.actionSystem.DataKey
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.SimpleToolWindowPanel
import com.intellij.openapi.util.Disposer
Expand All @@ -25,6 +27,8 @@ import java.util.concurrent.locks.ReentrantLock
import javax.swing.JComponent
import kotlin.concurrent.withLock

val ACTION_TOOLBAR = DataKey.create<ActionToolbar>("actionToolbar")

fun interface CutBufferListener {

companion object {
Expand All @@ -44,14 +48,14 @@ abstract class ExplorerContentProviderBase<Connection: ConnectionConfigBase, E :
abstract val place: String

/**
* Should build toolbar component that will be located at above the explorer view.
* Should build action toolbar that will be located at above the explorer view.
* @param target target component ([SimpleToolWindowPanel] by default) inside which the toolbar will be located.
* @return toolbar component instance.
* @return action toolbar instance.
*/
open fun buildActionToolbar(target: JComponent?): JComponent {
open fun buildActionToolbar(target: JComponent?): ActionToolbar {
return ActionManager.getInstance().createActionToolbar(place, actionGroup, true).apply {
targetComponent = target
}.component
}
}

/**
Expand All @@ -62,18 +66,22 @@ abstract class ExplorerContentProviderBase<Connection: ConnectionConfigBase, E :
override fun buildExplorerContent(parentDisposable: Disposable, project: Project): JComponent {
return object : SimpleToolWindowPanel(true, true), Disposable {

private val actionToolbar: ActionToolbar

private var builtContent: JComponent? = null

init {
Disposer.register(parentDisposable, this)
toolbar = buildActionToolbar(this)
actionToolbar = buildActionToolbar(this)
toolbar = actionToolbar.component
setContent(buildContent(this, project).also { builtContent = it })
}

override fun getData(dataId: String): Any? {
val view = getExplorerView(project)
return when {
EXPLORER_VIEW.`is`(dataId) -> view
ACTION_TOOLBAR.`is`(dataId) -> actionToolbar
else -> null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ package org.zowe.explorer.explorer.actions
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.ui.SimpleToolWindowPanel
import com.intellij.ui.HyperlinkAdapter
import com.intellij.ui.content.ContentManagerUtil
import org.zowe.explorer.config.configCrudable
import org.zowe.explorer.config.connect.CredentialService
import org.zowe.explorer.config.connect.ui.zosmf.ConnectionDialog
import org.zowe.explorer.config.connect.ui.zosmf.ConnectionDialogState
import org.zowe.explorer.config.connect.ui.zosmf.initEmptyUuids
import org.zowe.explorer.explorer.ACTION_TOOLBAR
import org.zowe.explorer.explorer.hints.Hint
import org.zowe.explorer.explorer.ui.EXPLORER_VIEW
import org.zowe.explorer.explorer.ui.FileExplorerView
Expand Down Expand Up @@ -68,9 +67,7 @@ class AddConnectionAction : AnAction() {
private fun showHint(e: AnActionEvent) {
val view = e.getData(EXPLORER_VIEW)
if (view?.myTree?.isEmpty == true) {
val contentManager = ContentManagerUtil.getContentManagerFromContext(e.dataContext, true)
val selectedContent = contentManager?.selectedContent
val toolbar = (selectedContent?.component.castOrNull<SimpleToolWindowPanel>())?.toolbar
val toolbar = e.getData(ACTION_TOOLBAR)?.component
val component = if (toolbar?.components?.isNotEmpty() == true) {
toolbar.components?.get(0).castOrNull<JComponent>()
} else {
Expand Down
Loading

0 comments on commit 7a186bb

Please sign in to comment.