mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
fix: host filtering may not work
This commit is contained in:
@@ -466,7 +466,7 @@ class NewHostTree : SimpleTree(), Disposable {
|
|||||||
val nodes = getSelectionSimpleTreeNodes(true).filter { it.isFolder.not() }
|
val nodes = getSelectionSimpleTreeNodes(true).filter { it.isFolder.not() }
|
||||||
if (nodes.isEmpty()) return
|
if (nodes.isEmpty()) return
|
||||||
val source = if (openInNewWindow)
|
val source = if (openInNewWindow)
|
||||||
TermoraFrameManager.Companion.getInstance().createWindow().apply { isVisible = true }
|
TermoraFrameManager.getInstance().createWindow().apply { isVisible = true }
|
||||||
else evt.source
|
else evt.source
|
||||||
nodes.map { it.host }.forEach { openHostAction.actionPerformed(OpenHostActionEvent(source, it, evt)) }
|
nodes.map { it.host }.forEach { openHostAction.actionPerformed(OpenHostActionEvent(source, it, evt)) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,12 +271,19 @@ open class SimpleTree : JXTree() {
|
|||||||
val nodes = mutableListOf<SimpleTreeNode<*>>()
|
val nodes = mutableListOf<SimpleTreeNode<*>>()
|
||||||
val parents = paths.mapNotNull { it.lastPathComponent }
|
val parents = paths.mapNotNull { it.lastPathComponent }
|
||||||
.filterIsInstance<SimpleTreeNode<*>>().toMutableList()
|
.filterIsInstance<SimpleTreeNode<*>>().toMutableList()
|
||||||
|
val model = super.getModel()
|
||||||
|
|
||||||
if (include) {
|
if (include) {
|
||||||
while (parents.isNotEmpty()) {
|
while (parents.isNotEmpty()) {
|
||||||
val node = parents.removeFirst()
|
val node = parents.removeFirst()
|
||||||
nodes.add(node)
|
nodes.add(node)
|
||||||
parents.addAll(node.children().toList().filterIsInstance<SimpleTreeNode<*>>())
|
val count = model.getChildCount(node)
|
||||||
|
for (i in 0 until count) {
|
||||||
|
val child = model.getChild(node, i)
|
||||||
|
if (child is SimpleTreeNode<*>) {
|
||||||
|
parents.add(child)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user