Skip to content

Commit 3636076

Browse files
authored
CM-38604 - Fix UI tree component loading in new IDE versions (#76)
1 parent 7e8e24d commit 3636076

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## [Unreleased]
66

7+
## [1.9.5] - 2024-07-30
8+
9+
- Fix UI tree component loading in new IDE versions
10+
711
## [1.9.4] - 2024-07-25
812

913
- Disable Sentry for on-premise installations
@@ -107,6 +111,8 @@
107111

108112
The first public release of the plugin.
109113

114+
[1.9.5]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.5
115+
110116
[1.9.4]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.4
111117

112118
[1.9.3]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.9.3
@@ -149,4 +155,4 @@ The first public release of the plugin.
149155

150156
[1.0.0]: https://github.com/cycodehq/intellij-platform-plugin/releases/tag/v1.0.0
151157

152-
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v1.9.4...HEAD
158+
[Unreleased]: https://github.com/cycodehq/intellij-platform-plugin/compare/v1.9.5...HEAD

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pluginGroup = com.cycode.plugin
44
pluginName = Cycode
55
pluginRepositoryUrl = https://github.com/cycodehq/intellij-platform-plugin
66
# SemVer format -> https://semver.org
7-
pluginVersion = 1.9.4
7+
pluginVersion = 1.9.5
88

99
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
1010
pluginSinceBuild = 211.1

src/main/kotlin/com/cycode/plugin/components/toolWindow/components/treeView/TreeView.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import javax.swing.JPanel
3535
import javax.swing.event.TreeSelectionEvent
3636
import javax.swing.event.TreeSelectionListener
3737
import javax.swing.tree.DefaultMutableTreeNode
38+
import javax.swing.tree.DefaultTreeModel
3839
import javax.swing.tree.TreePath
3940
import javax.swing.tree.TreeSelectionModel
4041

@@ -45,6 +46,7 @@ class TreeView(
4546

4647
// dummyRootNode is a workaround to allow us to hide the root node of the tree
4748
private val dummyRootNode = createNode(DummyNode())
49+
private val model = DefaultTreeModel(dummyRootNode)
4850
private val rootNodes: RootNodes = RootNodes()
4951

5052
private val splitPane: JBSplitter = JBSplitter()
@@ -56,9 +58,9 @@ class TreeView(
5658
init {
5759
createNodes(dummyRootNode)
5860

59-
tree = Tree(dummyRootNode)
60-
tree.setRootVisible(false)
61-
tree.setCellRenderer(TreeCellRenderer())
61+
tree = Tree(model)
62+
tree.isRootVisible = false
63+
tree.cellRenderer = TreeCellRenderer()
6264

6365
tree.selectionModel.selectionMode = TreeSelectionModel.SINGLE_TREE_SELECTION
6466
tree.addTreeSelectionListener(this) // we want to listen for when the user selects a node
@@ -264,7 +266,13 @@ class TreeView(
264266
// TODO(MarshalX): is possible to optimize this to only update the nodes that have changed
265267
dummyRootNode.removeAllChildren()
266268
createNodes(dummyRootNode)
267-
tree.updateUI()
269+
270+
/*
271+
Never use tree.updateUI() here.
272+
It crashes component in 2024.1.4, maybe in other versions too.
273+
It did not crash in 2023.3.7 and earlier.
274+
*/
275+
model.reload()
268276
}
269277

270278
private fun createNodes(top: DefaultMutableTreeNode) {

0 commit comments

Comments
 (0)