Skip to content

Commit c5916cd

Browse files
committed
fix(terminal): resolve compatibility issues in version 222 by refactoring rename lookup manager listener to use custom rename lookup element and improving shell command input popup. This commit fixes the compatibility issues in version 222 of the terminal extension by refactoring the rename lookup manager listener to use a custom rename lookup element. It also improves the shell command input popup by using more appropriate imports and methods from the UIUtil class.
1 parent 82caa05 commit c5916cd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

exts/ext-terminal/src/main/kotlin/cc/unitmesh/terminal/GenShellAction.kt renamed to exts/ext-terminal/src/main/kotlin/cc/unitmesh/terminal/ShellCommandSuggestionAction.kt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import com.intellij.ui.DocumentAdapter
1414
import com.intellij.ui.awt.RelativePoint
1515
import com.intellij.ui.components.JBLabel
1616
import com.intellij.util.ui.JBUI
17-
import com.intellij.util.ui.StartupUiUtil
1817
import com.intellij.util.ui.SwingHelper
18+
import com.intellij.util.ui.UIUtil
1919
import java.awt.Component
2020
import java.awt.Font
2121
import java.awt.Point
@@ -31,11 +31,12 @@ private const val OUTLINE_PROPERTY = "JComponent.outline"
3131
private const val ERROR_VALUE = "error"
3232

3333

34-
class GenShellAction : AnAction() {
34+
class ShellCommandSuggestionAction : AnAction() {
3535
override fun actionPerformed(e: AnActionEvent) {
3636
val project = e.project ?: return
3737
val contextComponent = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT) ?: return
38-
showContentRenamePopup(project, e.inputEvent?.component ?: contextComponent)
38+
39+
showContentRenamePopup(project, contextComponent)
3940
}
4041

4142
fun showContentRenamePopup(project: Project, component: Component) {
@@ -45,7 +46,7 @@ class GenShellAction : AnAction() {
4546
}
4647

4748
val label = JBLabel()
48-
label.font = StartupUiUtil.labelFont.deriveFont(Font.BOLD)
49+
label.font = UIUtil.getLabelFont().deriveFont(Font.BOLD)
4950

5051
val panel = SwingHelper.newLeftAlignedVerticalPanel(label, Box.createVerticalStrut(JBUI.scale(2)), textField)
5152
panel.addFocusListener(object : FocusAdapter() {
@@ -72,7 +73,8 @@ class GenShellAction : AnAction() {
7273
textField.repaint()
7374
return
7475
}
75-
// applyScript(content, project, textField.text)
76+
77+
createShellSuggestion(project, component, textField.text)
7678
balloon.hide()
7779
}
7880
}
@@ -95,4 +97,8 @@ class GenShellAction : AnAction() {
9597
}
9698
})
9799
}
100+
101+
private fun createShellSuggestion(project: Project, component: Component, text: String) {
102+
component
103+
}
98104
}

0 commit comments

Comments
 (0)