mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-15 18:02: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() }
|
||||
if (nodes.isEmpty()) return
|
||||
val source = if (openInNewWindow)
|
||||
TermoraFrameManager.Companion.getInstance().createWindow().apply { isVisible = true }
|
||||
TermoraFrameManager.getInstance().createWindow().apply { isVisible = true }
|
||||
else evt.source
|
||||
nodes.map { it.host }.forEach { openHostAction.actionPerformed(OpenHostActionEvent(source, it, evt)) }
|
||||
}
|
||||
|
||||
@@ -271,12 +271,19 @@ open class SimpleTree : JXTree() {
|
||||
val nodes = mutableListOf<SimpleTreeNode<*>>()
|
||||
val parents = paths.mapNotNull { it.lastPathComponent }
|
||||
.filterIsInstance<SimpleTreeNode<*>>().toMutableList()
|
||||
val model = super.getModel()
|
||||
|
||||
if (include) {
|
||||
while (parents.isNotEmpty()) {
|
||||
val node = parents.removeFirst()
|
||||
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