diff --git a/src/main/kotlin/app/termora/HostTree.kt b/src/main/kotlin/app/termora/HostTree.kt index 8dd37ee..588fdbf 100644 --- a/src/main/kotlin/app/termora/HostTree.kt +++ b/src/main/kotlin/app/termora/HostTree.kt @@ -64,13 +64,37 @@ class HostTree : JTree(), Disposable { hasFocus: Boolean ): Component { val host = value as Host - val c = super.getTreeCellRendererComponent(tree, host, sel, expanded, leaf, row, hasFocus) - if (host.protocol == Protocol.Folder) { - icon = if (expanded) FlatTreeOpenIcon() else FlatTreeClosedIcon() - } else if (host.protocol == Protocol.SSH || host.protocol == Protocol.Local) { - icon = if (sel && this@HostTree.hasFocus()) Icons.terminal.dark else Icons.terminal + var text = host.name + val color = if (sel) { + if (this@HostTree.hasFocus()) { + UIManager.getColor("textHighlightText") + } else { + this.foreground + } + } else { + UIManager.getColor("textInactiveText") + } + + if (host.protocol == Protocol.SSH) { + text = """ + ${host.name} +    + ${host.username}@${host.host} + """.trimIndent() } else if (host.protocol == Protocol.Serial) { - icon = if (sel && this@HostTree.hasFocus()) Icons.plugin.dark else Icons.plugin + text = """ + ${host.name} +    + ${host.options.serialComm.port} + """.trimIndent() + } + + val c = super.getTreeCellRendererComponent(tree, text, sel, expanded, leaf, row, hasFocus) + + icon = when (host.protocol) { + Protocol.Folder -> if (expanded) FlatTreeOpenIcon() else FlatTreeClosedIcon() + Protocol.SSH, Protocol.Local -> if (sel && this@HostTree.hasFocus()) Icons.terminal.dark else Icons.terminal + Protocol.Serial -> if (sel && this@HostTree.hasFocus()) Icons.plugin.dark else Icons.plugin } return c }