mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
feat: SFTP command add key shortcut
This commit is contained in:
@@ -85,10 +85,6 @@ class TermoraRestarter {
|
|||||||
|
|
||||||
private fun doRestart() {
|
private fun doRestart() {
|
||||||
|
|
||||||
for (window in TermoraFrameManager.getInstance().getWindows()) {
|
|
||||||
window.dispose()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SystemInfo.isMacOS) {
|
if (SystemInfo.isMacOS) {
|
||||||
Restarter.restart(arrayOf("open", "-n", macOSApplicationPath))
|
Restarter.restart(arrayOf("open", "-n", macOSApplicationPath))
|
||||||
} else if (SystemInfo.isWindows && startupCommand != null) {
|
} else if (SystemInfo.isWindows && startupCommand != null) {
|
||||||
@@ -100,6 +96,10 @@ class TermoraRestarter {
|
|||||||
Restarter.restart(arrayOf(startupCommand))
|
Restarter.restart(arrayOf(startupCommand))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (window in TermoraFrameManager.getInstance().getWindows()) {
|
||||||
|
window.dispose()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class ActionManager : org.jdesktop.swingx.action.ActionManager() {
|
|||||||
addAction(Actions.KEYWORD_HIGHLIGHT, KeywordHighlightAction())
|
addAction(Actions.KEYWORD_HIGHLIGHT, KeywordHighlightAction())
|
||||||
addAction(Actions.TERMINAL_LOGGER, TerminalLoggerAction())
|
addAction(Actions.TERMINAL_LOGGER, TerminalLoggerAction())
|
||||||
addAction(Actions.SFTP, SFTPAction())
|
addAction(Actions.SFTP, SFTPAction())
|
||||||
|
addAction(SFTPCommandAction.SFTP_COMMAND, SFTPCommandAction())
|
||||||
addAction(Actions.MACRO, MacroAction())
|
addAction(Actions.MACRO, MacroAction())
|
||||||
addAction(Actions.KEY_MANAGER, KeyManagerAction())
|
addAction(Actions.KEY_MANAGER, KeyManagerAction())
|
||||||
|
|
||||||
|
|||||||
30
src/main/kotlin/app/termora/actions/SFTPCommandAction.kt
Normal file
30
src/main/kotlin/app/termora/actions/SFTPCommandAction.kt
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package app.termora.actions
|
||||||
|
|
||||||
|
import app.termora.HostTerminalTab
|
||||||
|
import app.termora.I18n
|
||||||
|
import app.termora.OpenHostActionEvent
|
||||||
|
import app.termora.Protocol
|
||||||
|
|
||||||
|
class SFTPCommandAction : AnAction() {
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* 打开 SFTP command
|
||||||
|
*/
|
||||||
|
const val SFTP_COMMAND = "SFTPCommandAction"
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
putValue(ACTION_COMMAND_KEY, SFTP_COMMAND)
|
||||||
|
putValue(SHORT_DESCRIPTION, I18n.getString("termora.actions.open-sftp-command"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun actionPerformed(evt: AnActionEvent) {
|
||||||
|
val actionManager = ActionManager.getInstance().getAction(OpenHostAction.OPEN_HOST) ?: return
|
||||||
|
val terminalTabbedManager = evt.getData(DataProviders.TerminalTabbedManager) ?: return
|
||||||
|
val tab = terminalTabbedManager.getSelectedTerminalTab() as? HostTerminalTab ?: return
|
||||||
|
val host = tab.host
|
||||||
|
if (!(host.protocol == Protocol.SSH || host.protocol == Protocol.SFTPPty)) return
|
||||||
|
actionManager.actionPerformed(OpenHostActionEvent(evt.source, host.copy(protocol = Protocol.SFTPPty), evt))
|
||||||
|
evt.consume()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,6 +76,12 @@ class KeymapImpl(private val menuShortcutKeyMaskEx: Int) : Keymap("Keymap", null
|
|||||||
KeyShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, menuShortcutKeyMaskEx or InputEvent.SHIFT_DOWN_MASK))
|
KeyShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_R, menuShortcutKeyMaskEx or InputEvent.SHIFT_DOWN_MASK))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Command + Shift + P
|
||||||
|
addShortcut(
|
||||||
|
SFTPCommandAction.SFTP_COMMAND,
|
||||||
|
KeyShortcut(KeyStroke.getKeyStroke(KeyEvent.VK_P, menuShortcutKeyMaskEx or InputEvent.SHIFT_DOWN_MASK))
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
// switch map
|
// switch map
|
||||||
for (i in KeyEvent.VK_1..KeyEvent.VK_9) {
|
for (i in KeyEvent.VK_1..KeyEvent.VK_9) {
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ class KeymapTableModel : DefaultTableModel() {
|
|||||||
TerminalZoomOutAction.ZOOM_OUT,
|
TerminalZoomOutAction.ZOOM_OUT,
|
||||||
TerminalZoomResetAction.ZOOM_RESET,
|
TerminalZoomResetAction.ZOOM_RESET,
|
||||||
OpenLocalTerminalAction.LOCAL_TERMINAL,
|
OpenLocalTerminalAction.LOCAL_TERMINAL,
|
||||||
TerminalClearScreenAction.CLEAR_SCREEN,
|
|
||||||
FindEverywhereAction.FIND_EVERYWHERE,
|
FindEverywhereAction.FIND_EVERYWHERE,
|
||||||
NewWindowAction.NEW_WINDOW,
|
NewWindowAction.NEW_WINDOW,
|
||||||
TabReconnectAction.RECONNECT_TAB,
|
TabReconnectAction.RECONNECT_TAB,
|
||||||
|
TerminalClearScreenAction.CLEAR_SCREEN,
|
||||||
|
SFTPCommandAction.SFTP_COMMAND,
|
||||||
SwitchTabAction.SWITCH_TAB,
|
SwitchTabAction.SWITCH_TAB,
|
||||||
)) {
|
)) {
|
||||||
val action = actionManager.getAction(id) ?: continue
|
val action = actionManager.getAction(id) ?: continue
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ termora.actions.open-local-terminal=Open Local Terminal
|
|||||||
termora.actions.open-find-everywhere=Open FindEverywhere
|
termora.actions.open-find-everywhere=Open FindEverywhere
|
||||||
termora.actions.open-new-window=Open new Window
|
termora.actions.open-new-window=Open new Window
|
||||||
termora.actions.clear-screen=Clear Terminal Screen
|
termora.actions.clear-screen=Clear Terminal Screen
|
||||||
|
termora.actions.open-sftp-command=Open SFTP Command
|
||||||
termora.actions.switch-tab=Switch to specific Tab [1..9]
|
termora.actions.switch-tab=Switch to specific Tab [1..9]
|
||||||
|
|
||||||
# Terminal
|
# Terminal
|
||||||
|
|||||||
@@ -334,6 +334,7 @@ termora.actions.open-local-terminal=打开本地终端
|
|||||||
termora.actions.open-find-everywhere=打开全局查找
|
termora.actions.open-find-everywhere=打开全局查找
|
||||||
termora.actions.open-new-window=打开新窗口
|
termora.actions.open-new-window=打开新窗口
|
||||||
termora.actions.clear-screen=清除终端屏幕
|
termora.actions.clear-screen=清除终端屏幕
|
||||||
|
termora.actions.open-sftp-command=打开 SFTP 终端
|
||||||
termora.actions.switch-tab=切换到特定标签页 [1..9]
|
termora.actions.switch-tab=切换到特定标签页 [1..9]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -314,6 +314,7 @@ termora.actions.open-local-terminal=開啟本地終端
|
|||||||
termora.actions.open-find-everywhere=開啟全域搜尋
|
termora.actions.open-find-everywhere=開啟全域搜尋
|
||||||
termora.actions.open-new-window=開啟新視窗
|
termora.actions.open-new-window=開啟新視窗
|
||||||
termora.actions.clear-screen=清除終端機螢幕
|
termora.actions.clear-screen=清除終端機螢幕
|
||||||
|
termora.actions.open-sftp-command=打開 SFTP 終端
|
||||||
termora.actions.switch-tab=切換到特定分頁 [1..9]
|
termora.actions.switch-tab=切換到特定分頁 [1..9]
|
||||||
|
|
||||||
# Visual Window
|
# Visual Window
|
||||||
|
|||||||
Reference in New Issue
Block a user