mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 10:22:58 +08:00
fix: possible invalid window creation
This commit is contained in:
@@ -450,11 +450,13 @@ class HostTree : JTree(), Disposable {
|
|||||||
|
|
||||||
private fun openHosts(evt: EventObject, openInNewWindow: Boolean) {
|
private fun openHosts(evt: EventObject, openInNewWindow: Boolean) {
|
||||||
assertEventDispatchThread()
|
assertEventDispatchThread()
|
||||||
val openHostAction = ActionManager.getInstance().getAction(OpenHostAction.OPEN_HOST) ?: return
|
|
||||||
val nodes = getSelectionNodes().filter { it.protocol != Protocol.Folder }
|
val nodes = getSelectionNodes().filter { it.protocol != Protocol.Folder }
|
||||||
|
if (nodes.isEmpty()) return
|
||||||
|
val openHostAction = ActionManager.getInstance().getAction(OpenHostAction.OPEN_HOST) ?: return
|
||||||
val source = if (openInNewWindow)
|
val source = if (openInNewWindow)
|
||||||
TermoraFrameManager.getInstance().createWindow().apply { isVisible = true }
|
TermoraFrameManager.getInstance().createWindow().apply { isVisible = true }
|
||||||
else evt.source
|
else evt.source
|
||||||
|
|
||||||
nodes.forEach { openHostAction.actionPerformed(OpenHostActionEvent(source, it, evt)) }
|
nodes.forEach { openHostAction.actionPerformed(OpenHostActionEvent(source, it, evt)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user