Skip to content

Commit 29f69a9

Browse files
committed
Working on the new architectural representation of the plugin
Signed-off-by: Uladzislau Kalesnikau <[email protected]>
1 parent 690ac5f commit 29f69a9

Some content is hidden

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

42 files changed

+1913
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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
16+
17+
import com.intellij.openapi.project.DumbAware
18+
import com.intellij.openapi.project.Project
19+
import com.intellij.openapi.wm.ToolWindow
20+
import com.intellij.openapi.wm.ToolWindowFactory
21+
import com.intellij.ui.content.ContentFactory
22+
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
23+
24+
// TODO: doc
25+
class ZoweExplorerToolWindowFactory : ToolWindowFactory, DumbAware {
26+
override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
27+
val contentFactory = ContentFactory.getInstance()
28+
val filesExplorerComponent = ExplorerTreeComponentService.getService().getFilesExplorerComponent(project)
29+
val filesExplorerContent = contentFactory.createContent(
30+
filesExplorerComponent.initExplorerTreeComponent(),
31+
filesExplorerComponent.explorerName,
32+
filesExplorerComponent.isLockable
33+
)
34+
toolWindow.contentManager.addContent(filesExplorerContent)
35+
// TODO: JES Explorer View
36+
}
37+
38+
override fun init(toolWindow: ToolWindow) {
39+
// subscribe(
40+
// project = toolWindow.project,
41+
// topic = AutoSyncFileListener.AUTO_SYNC_FILE,
42+
// handler = object : AutoSyncFileListener {
43+
// override fun sync(file: VirtualFile) {
44+
// val dataOpsManager = DataOpsManager.getService()
45+
// if (dataOpsManager.isSyncSupported(file)) {
46+
// val contentSynchronizer = dataOpsManager.getContentSynchronizer(file) ?: return
47+
// runBackgroundableTask("Synchronizing file ${file.name} with mainframe") { indicator ->
48+
// val syncProvider = DocumentedSyncProvider(file)
49+
// runInEdtAndWait { syncProvider.saveDocument() }
50+
// contentSynchronizer.synchronizeWithRemote(syncProvider, indicator)
51+
// }
52+
// }
53+
// }
54+
// })
55+
}
56+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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
16+
17+
import com.intellij.openapi.actionSystem.ActionUpdateThread
18+
import com.intellij.openapi.project.DumbAwareAction
19+
20+
// TODO: doc
21+
abstract class DumbAwareEDTAction : DumbAwareAction() {
22+
override fun getActionUpdateThread() = ActionUpdateThread.EDT
23+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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
16+
17+
import com.intellij.openapi.actionSystem.AnActionEvent
18+
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
19+
import org.zowe.explorer.v3.tree.nodes.RefreshableNode
20+
21+
// TODO: doc
22+
class RefreshNodeAction : DumbAwareEDTAction() {
23+
override fun actionPerformed(e: AnActionEvent) {
24+
val project = e.project ?: return
25+
ExplorerTreeComponentService.getService()
26+
.getFilesExplorerComponent(project)
27+
.selectedNodes
28+
.forEach {
29+
if (it is RefreshableNode) {
30+
it.refreshNode()
31+
}
32+
}
33+
}
34+
35+
override fun update(e: AnActionEvent) {
36+
val project = e.project ?: let {
37+
e.presentation.isEnabledAndVisible = false
38+
return
39+
}
40+
val explorerComponent = ExplorerTreeComponentService.getService()
41+
.getFilesExplorerComponent(project)
42+
e.presentation.isEnabledAndVisible = explorerComponent
43+
.selectedNodes
44+
.any { it is RefreshableNode }
45+
}
46+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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
16+
17+
import com.intellij.openapi.actionSystem.AnActionEvent
18+
import org.zowe.explorer.v3.components.ExplorerTreeComponentService
19+
import org.zowe.explorer.v3.tree.nodes.RefreshableNode
20+
import org.zowe.explorer.v3.tree.nodes.Renameable
21+
22+
// TODO: doc
23+
class RenameNodeAction : DumbAwareEDTAction() {
24+
override fun actionPerformed(e: AnActionEvent) {
25+
val project = e.project ?: return
26+
val selectedNodes = ExplorerTreeComponentService.getService()
27+
.getFilesExplorerComponent(project)
28+
.selectedNodes
29+
if (selectedNodes.size == 1) {
30+
(selectedNodes[0] as? Renameable)?.renameNode()
31+
}
32+
// TODO: process e.dataContext as well???
33+
}
34+
35+
override fun update(e: AnActionEvent) {
36+
val project = e.project ?: let {
37+
e.presentation.isEnabledAndVisible = false
38+
return
39+
}
40+
val explorerComponent = ExplorerTreeComponentService.getService()
41+
.getFilesExplorerComponent(project)
42+
val selectedNodes = explorerComponent.selectedNodes
43+
if (selectedNodes.size == 1) {
44+
e.presentation.isEnabledAndVisible = (selectedNodes[0] as? Renameable) != null
45+
}
46+
// TODO: process e.dataContext as well???
47+
}
48+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 com.intellij.util.containers.isEmpty
19+
import org.zowe.explorer.common.message
20+
import org.zowe.explorer.utils.addTooltip
21+
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
25+
26+
// 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) */
42+
override fun actionPerformed(e: AnActionEvent) {
43+
TODO("Not yet implemented")
44+
// TODO: CreateFilesWorkingSetDialog
45+
}
46+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
*/
13+
14+
package org.zowe.explorer.v3.actions.workingset
15+
16+
// TODO: doc
17+
class CreateFilesWorkingSetDialog {
18+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 org.zowe.explorer.v3.actions.DumbAwareEDTAction
18+
19+
// TODO: doc
20+
abstract class CreateWorkingSetAction : DumbAwareEDTAction()
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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.components
16+
17+
import com.intellij.openapi.components.Service
18+
import com.intellij.openapi.components.service
19+
import com.intellij.openapi.project.Project
20+
import com.intellij.openapi.util.Disposer
21+
import org.zowe.explorer.v3.components.files.FilesExplorerComponent
22+
23+
// TODO: doc
24+
@Service
25+
class ExplorerTreeComponentService {
26+
companion object {
27+
fun getService(): ExplorerTreeComponentService = service()
28+
}
29+
30+
private val projectsToFilesExplorerComponents = mutableMapOf<Project, FilesExplorerComponent>()
31+
// private lateinit var projectToJESExplorerComponent: Pair<Project, FilesExplorerComponent>
32+
33+
fun getFilesExplorerComponent(project: Project): FilesExplorerComponent {
34+
val projectToFilesExplorerComponent = projectsToFilesExplorerComponents[project]
35+
return if (projectToFilesExplorerComponent == null) {
36+
val filesExplorerComponent = FilesExplorerComponent(project)
37+
Disposer.register(project, filesExplorerComponent)
38+
projectsToFilesExplorerComponents[project] = filesExplorerComponent
39+
filesExplorerComponent
40+
} else projectToFilesExplorerComponent
41+
}
42+
43+
// fun getJESExplorerComponent(project: Project):
44+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
*/
13+
14+
package org.zowe.explorer.v3.components.files
15+
16+
import com.intellij.openapi.project.Project
17+
import org.zowe.explorer.v3.tree.nodes.ExplorerTreeNode
18+
import org.zowe.explorer.v3.tree.nodes.NoItemsFoundNode
19+
import org.zowe.explorer.v3.tree.nodes.RefreshInfoNodeData
20+
import org.zowe.explorer.v3.tree.nodes.RefreshableNode
21+
22+
// TODO: doc
23+
class DatasetMaskNode(
24+
project: Project,
25+
nodeData: RefreshInfoNodeData,
26+
parent: ExplorerTreeNode
27+
) : RefreshableNode(project, nodeData, parent) {
28+
override fun fetchChildren(): List<ExplorerTreeNode> {
29+
return listOf(NoItemsFoundNode(project, parent = this))
30+
}
31+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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.components.files
16+
17+
import org.zowe.explorer.v3.icons.ZoweExplorerIcons
18+
import org.zowe.explorer.v3.state.config.ConnectionConfigRelated
19+
import org.zowe.explorer.v3.tree.nodes.RefreshInfoNodeData
20+
21+
// TODO: doc
22+
class DatasetMaskNodeData(
23+
datasetMask: String,
24+
tooltip: String = "Data set mask",
25+
override val connectionConfigUuid: String
26+
) : RefreshInfoNodeData(datasetMask, tooltip, ZoweExplorerIcons.datasetMask),
27+
ConnectionConfigRelated

0 commit comments

Comments
 (0)