Skip to content

Commit da17fa6

Browse files
committed
Continuing to work on the new architecture, NodeSyncService implemented
Signed-off-by: Uladzislau Kalesnikau <[email protected]>
1 parent 29f69a9 commit da17fa6

File tree

72 files changed

+1966
-831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1966
-831
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mockk = "1.14.0"
1010
kotest = "5.9.1"
1111
jgrapht = "1.5.2"
1212
keytar = "1.0.0"
13-
zowe-kotlin-sdk = "0.5.2-rc.1"
13+
zowe-kotlin-sdk = "1.0.0-rc.1"
1414
ibm-mq-allclient = "9.4.0.0"
1515

1616
# plugins
@@ -29,7 +29,7 @@ retrofit2-converter-scalars = { group = "com.squareup.retrofit2", name = "conver
2929
okhttp3 = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp3" }
3030
jgrapht-core = { group = "org.jgrapht", name = "jgrapht-core", version.ref = "jgrapht" }
3131
java-keytar = { group = "com.starxg", name = "java-keytar", version.ref = "keytar" }
32-
zowe-kotlin-sdk = { group = "org.zowe.sdk", name = "zowe-kotlin-sdk", version.ref = "zowe-kotlin-sdk" }
32+
zowe-kotlin-sdk = { group = "org.zowe.sdk", name = "kotlinsdk", version.ref = "zowe-kotlin-sdk" }
3333
ibm-mq-allclient = { group = "com.ibm.mq", name = "com.ibm.mq.allclient", version.ref = "ibm-mq-allclient" }
3434

3535
# test deps

src/main/kotlin/org/zowe/explorer/v3/ZoweExplorerToolWindowFactory.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,32 @@ import com.intellij.openapi.project.Project
1919
import com.intellij.openapi.wm.ToolWindow
2020
import com.intellij.openapi.wm.ToolWindowFactory
2121
import com.intellij.ui.content.ContentFactory
22-
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
22+
import org.zowe.explorer.v3.tree.ExplorerTreeComponentService
2323

2424
// TODO: doc
2525
class ZoweExplorerToolWindowFactory : ToolWindowFactory, DumbAware {
2626
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
2727
val contentFactory = ContentFactory.getInstance()
28+
2829
val filesExplorerComponent = ExplorerTreeComponentService.getService().getFilesExplorerComponent(project)
2930
val filesExplorerContent = contentFactory.createContent(
3031
filesExplorerComponent.initExplorerTreeComponent(),
3132
filesExplorerComponent.explorerName,
3233
filesExplorerComponent.isLockable
3334
)
3435
toolWindow.contentManager.addContent(filesExplorerContent)
35-
// TODO: JES Explorer View
36+
37+
val jesExplorerComponent = ExplorerTreeComponentService.getService().getJesExplorerComponent(project)
38+
val jesExplorerContent = contentFactory.createContent(
39+
jesExplorerComponent.initExplorerTreeComponent(),
40+
jesExplorerComponent.explorerName,
41+
jesExplorerComponent.isLockable
42+
)
43+
toolWindow.contentManager.addContent(jesExplorerContent)
3644
}
3745

3846
override fun init(toolWindow: ToolWindow) {
47+
// TODO: define what to do with it
3948
// subscribe(
4049
// project = toolWindow.project,
4150
// topic = AutoSyncFileListener.AUTO_SYNC_FILE,

src/main/kotlin/org/zowe/explorer/v3/actions/RefreshNodeAction.kt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
package org.zowe.explorer.v3.actions
1616

1717
import com.intellij.openapi.actionSystem.AnActionEvent
18-
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
19-
import org.zowe.explorer.v3.tree.nodes.RefreshableNode
18+
import org.zowe.explorer.v3.tree.ExplorerTreeComponentService
19+
import org.zowe.explorer.v3.tree.nodes.Refreshable
2020

2121
// TODO: doc
2222
class RefreshNodeAction : DumbAwareEDTAction() {
@@ -26,8 +26,11 @@ class RefreshNodeAction : DumbAwareEDTAction() {
2626
.getFilesExplorerComponent(project)
2727
.selectedNodes
2828
.forEach {
29-
if (it is RefreshableNode) {
30-
it.refreshNode()
29+
if (
30+
it.nodeDescriptor is Refreshable
31+
&& ((it.nodeDescriptor as? Refreshable)?.isNodeReadyForRefresh(it) ?: false)
32+
) {
33+
(it.nodeDescriptor as? Refreshable)?.refreshNode(it)
3134
}
3235
}
3336
}
@@ -41,6 +44,12 @@ class RefreshNodeAction : DumbAwareEDTAction() {
4144
.getFilesExplorerComponent(project)
4245
e.presentation.isEnabledAndVisible = explorerComponent
4346
.selectedNodes
44-
.any { it is RefreshableNode }
47+
.any { it.nodeDescriptor is Refreshable }
48+
e.presentation.isVisible = explorerComponent
49+
.selectedNodes
50+
.any {
51+
it.nodeDescriptor is Refreshable
52+
&& ((it.nodeDescriptor as? Refreshable)?.isNodeReadyForRefresh(it) ?: false)
53+
}
4554
}
4655
}

src/main/kotlin/org/zowe/explorer/v3/actions/RenameNodeAction.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
package org.zowe.explorer.v3.actions
1616

1717
import com.intellij.openapi.actionSystem.AnActionEvent
18-
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
19-
import org.zowe.explorer.v3.tree.nodes.RefreshableNode
18+
import org.zowe.explorer.v3.tree.ExplorerTreeComponentService
2019
import org.zowe.explorer.v3.tree.nodes.Renameable
2120

2221
// TODO: doc
@@ -27,7 +26,7 @@ class RenameNodeAction : DumbAwareEDTAction() {
2726
.getFilesExplorerComponent(project)
2827
.selectedNodes
2928
if (selectedNodes.size == 1) {
30-
(selectedNodes[0] as? Renameable)?.renameNode()
29+
(selectedNodes[0].nodeDescriptor as? Renameable)?.renameNode()
3130
}
3231
// TODO: process e.dataContext as well???
3332
}
@@ -41,7 +40,7 @@ class RenameNodeAction : DumbAwareEDTAction() {
4140
.getFilesExplorerComponent(project)
4241
val selectedNodes = explorerComponent.selectedNodes
4342
if (selectedNodes.size == 1) {
44-
e.presentation.isEnabledAndVisible = (selectedNodes[0] as? Renameable) != null
43+
e.presentation.isEnabledAndVisible = (selectedNodes[0].nodeDescriptor as? Renameable) != null
4544
}
4645
// TODO: process e.dataContext as well???
4746
}

src/main/kotlin/org/zowe/explorer/v3/actions/workingset/CreateFilesWorkingSetAction.kt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,13 @@
1515
package org.zowe.explorer.v3.actions.workingset
1616

1717
import com.intellij.openapi.actionSystem.AnActionEvent
18-
import com.intellij.util.containers.isEmpty
19-
import org.zowe.explorer.common.message
20-
import org.zowe.explorer.utils.addTooltip
2118
import org.zowe.explorer.v3.components.files.FilesExplorerComponent
22-
import org.zowe.explorer.v3.state.config.ConfigType
23-
import org.zowe.explorer.v3.state.storage.StableStorage
24-
import org.zowe.explorer.v3.state.storage.StorageService
2519

2620
// TODO: doc
27-
class CreateFilesWorkingSetAction : CreateWorkingSetAction() {
28-
@OptIn(StableStorage::class)
29-
override fun update(e: AnActionEvent) {
30-
e.presentation.text = "Files Working Set"
31-
e.presentation.isEnabledAndVisible = e.place.contains(FilesExplorerComponent.FILES_EXPLORER_COMPONENT_NAME)
32-
val isConnectionConfigCreated = !StorageService.getService()
33-
.getConfigsFromStorage(ConfigType.HTTP_CONNECTION_CONFIG_V1)
34-
.isEmpty()
35-
e.presentation.isEnabled = isConnectionConfigCreated
36-
if (!isConnectionConfigCreated) {
37-
e.presentation.addTooltip(message("create.connection.tooltip"))
38-
}
39-
}
40-
41-
/** Shows add Working Set dialog (for files or for jobs) */
21+
class CreateFilesWorkingSetAction : CreateWorkingSetAction(
22+
"Files Working Set",
23+
FilesExplorerComponent.FILES_EXPLORER_COMPONENT_NAME
24+
) {
4225
override fun actionPerformed(e: AnActionEvent) {
4326
TODO("Not yet implemented")
4427
// TODO: CreateFilesWorkingSetDialog
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*
10+
* Contributors:
11+
* Zowe Community
12+
* Uladzislau Kalesnikau
13+
*/
14+
15+
package org.zowe.explorer.v3.actions.workingset
16+
17+
import com.intellij.openapi.actionSystem.AnActionEvent
18+
import org.zowe.explorer.v3.components.jes.JesExplorerComponent
19+
20+
// TODO: doc
21+
class CreateJesWorkingSetAction : CreateWorkingSetAction(
22+
"JES Working Set",
23+
JesExplorerComponent.JES_EXPLORER_COMPONENT_NAME
24+
) {
25+
override fun actionPerformed(e: AnActionEvent) {
26+
TODO("Not yet implemented")
27+
}
28+
}

src/main/kotlin/org/zowe/explorer/v3/actions/workingset/CreateWorkingSetAction.kt

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,28 @@
1414

1515
package org.zowe.explorer.v3.actions.workingset
1616

17+
import com.intellij.openapi.actionSystem.AnActionEvent
18+
import com.intellij.util.containers.isEmpty
19+
import org.zowe.explorer.common.message
20+
import org.zowe.explorer.utils.addTooltip
1721
import org.zowe.explorer.v3.actions.DumbAwareEDTAction
22+
import org.zowe.explorer.v3.state.config.ConfigType
23+
import org.zowe.explorer.v3.state.config.cache.ConfigCacheService
1824

1925
// TODO: doc
20-
abstract class CreateWorkingSetAction : DumbAwareEDTAction()
26+
abstract class CreateWorkingSetAction(
27+
private val workingSetType: String,
28+
private val targetExplorer: String
29+
) : DumbAwareEDTAction() {
30+
override fun update(e: AnActionEvent) {
31+
e.presentation.text = workingSetType
32+
e.presentation.isEnabledAndVisible = e.place.contains(targetExplorer)
33+
val isConnectionConfigCreated = !ConfigCacheService.getService()
34+
.getConfigsFromCache(ConfigType.HTTP_CONNECTION_CONFIG_V1)
35+
.isEmpty()
36+
e.presentation.isEnabled = isConnectionConfigCreated
37+
if (!isConnectionConfigCreated) {
38+
e.presentation.addTooltip(message("create.connection.tooltip"))
39+
}
40+
}
41+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* This program and the accompanying materials are made available under the terms of the
3+
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
4+
* https://www.eclipse.org/legal/epl-v20.html
5+
*
6+
* SPDX-License-Identifier: EPL-2.0
7+
*
8+
* Copyright Contributors to the Zowe Project.
9+
*
10+
* Contributors:
11+
* Zowe Community
12+
* Uladzislau Kalesnikau
13+
*/
14+
15+
package org.zowe.explorer.v3.api
16+
17+
import com.intellij.openapi.components.Service
18+
import com.intellij.openapi.components.service
19+
import com.intellij.util.net.ssl.CertificateManager
20+
import io.ktor.client.HttpClient
21+
import io.ktor.client.engine.cio.CIO
22+
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
23+
import io.ktor.serialization.kotlinx.json.json
24+
import kotlinx.serialization.json.Json
25+
import org.zowe.kotlinsdk.core.WrapperType
26+
import org.zowe.kotlinsdk.core.datasets.api.DatasetsAPI
27+
import org.zowe.kotlinsdk.core.files.api.FilesAPI
28+
import org.zowe.kotlinsdk.providers.zowe.HttpRequestRunner
29+
import org.zowe.kotlinsdk.providers.zowe.ZoweAPIProvider
30+
31+
// TODO: doc
32+
@Service
33+
class ZosmfApiService {
34+
companion object {
35+
fun getService(): ZosmfApiService = service()
36+
}
37+
38+
private val zosmfClient by lazy {
39+
HttpClient(CIO) {
40+
install(ContentNegotiation.Plugin) {
41+
json(
42+
Json {
43+
ignoreUnknownKeys = true
44+
prettyPrint = true
45+
}
46+
)
47+
}
48+
engine {
49+
https {
50+
trustManager = CertificateManager.getInstance().trustManager
51+
}
52+
}
53+
}
54+
}
55+
56+
private val zoweAPIProvider by lazy { ZoweAPIProvider(listOf(HttpRequestRunner(zosmfClient))) }
57+
58+
val datasets: DatasetsAPI by lazy { zoweAPIProvider.getApi(WrapperType.ZOSMF, DatasetsAPI::class.java) }
59+
val files: FilesAPI by lazy { zoweAPIProvider.getApi(WrapperType.ZOSMF, FilesAPI::class.java) }
60+
}

src/main/kotlin/org/zowe/explorer/v3/components/files/DatasetMaskNode.kt

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main/kotlin/org/zowe/explorer/v3/components/files/DatasetMaskNodeData.kt

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)