Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IJMP-2111 Make interchangeable the Zowe Team Configuration item #212

Open
wants to merge 1 commit into
base: release/v2.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.fileEditor.OpenFileDescriptor
import com.intellij.openapi.vfs.VirtualFileManager
import org.zowe.explorer.config.ConfigService
import org.zowe.explorer.config.connect.CredentialService
Expand Down Expand Up @@ -53,8 +54,8 @@ class AddZoweTeamConfigAction : AnAction() {
runReadAction {
VirtualFileManager.getInstance().findFileByNioPath(Path.of(zoweConfigLocation))
}?.let {
e.presentation.isEnabled = false
e.presentation.description = "$ZOWE_CONFIG_NAME already exists in the project"
e.presentation.text = "Edit Zowe Team Configuration"
e.presentation.description = "Edit Zowe Team Configuration file"
} ?: return
}

Expand All @@ -63,6 +64,13 @@ class AddZoweTeamConfigAction : AnAction() {
* @see com.intellij.openapi.actionSystem.AnAction.actionPerformed
*/
override fun actionPerformed(e: AnActionEvent) {
runReadAction {
VirtualFileManager.getInstance().findFileByNioPath(Path.of("${e.project?.basePath}/$ZOWE_CONFIG_NAME"))
}?.let {vf ->
e.project?.let { project -> OpenFileDescriptor(project, vf) }?.navigate(false)
return
}

val configCrudable = ConfigService.getService().crudable
val state = ZoweTeamConfigDialog.showAndTestConnection(
crudable = configCrudable,
Expand All @@ -72,8 +80,8 @@ class AddZoweTeamConfigAction : AnAction() {
if (state != null) {
val connectionConfig = state.connectionConfig
val project = e.project ?: let {
e.presentation.isEnabled = false
e.presentation.description = "$ZOWE_CONFIG_NAME already exists in the project"
e.presentation.text = "Edit Zowe Team Configuration"
e.presentation.description = "Edit Zowe Team Configuration file"
return
}
val zoweConfigService = ZoweConfigService.getInstance(project)
Expand Down
Loading
Loading