mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: improve sftp tab (#583)
This commit is contained in:
@@ -56,6 +56,16 @@ class SFTPAction : AnAction("SFTP", Icons.folder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val host = hostManager.getHost(hostId) ?: return
|
val host = hostManager.getHost(hostId) ?: return
|
||||||
|
for (i in 0 until tabbed.tabCount) {
|
||||||
|
val c = tabbed.getComponentAt(i)
|
||||||
|
if (c is SFTPFileSystemViewPanel) {
|
||||||
|
if (c.state == SFTPFileSystemViewPanel.State.Initialized) {
|
||||||
|
c.selectHost(host)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tabbed.addSFTPFileSystemViewPanelTab(host)
|
tabbed.addSFTPFileSystemViewPanelTab(host)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,9 +286,7 @@ class SFTPFileSystemViewPanel(
|
|||||||
val node = tree.getLastSelectedPathNode() ?: return
|
val node = tree.getLastSelectedPathNode() ?: return
|
||||||
if (node.isFolder) return
|
if (node.isFolder) return
|
||||||
val host = node.data as Host
|
val host = node.data as Host
|
||||||
that.setTabTitle(host.name)
|
selectHost(host)
|
||||||
that.host = host
|
|
||||||
that.connect()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -318,6 +316,12 @@ class SFTPFileSystemViewPanel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun selectHost(host: Host) {
|
||||||
|
that.setTabTitle(host.name)
|
||||||
|
that.host = host
|
||||||
|
that.connect()
|
||||||
|
}
|
||||||
|
|
||||||
private fun setTabTitle(title: String) {
|
private fun setTabTitle(title: String) {
|
||||||
val tabbed = SwingUtilities.getAncestorOfClass(JTabbedPane::class.java, that)
|
val tabbed = SwingUtilities.getAncestorOfClass(JTabbedPane::class.java, that)
|
||||||
if (tabbed is JTabbedPane) {
|
if (tabbed is JTabbedPane) {
|
||||||
|
|||||||
Reference in New Issue
Block a user