@@ -39,10 +39,10 @@ class EditFileCommandProcessor(private val project: Project) {
39
39
}
40
40
41
41
if (isAutoSketchMode) {
42
- executeEditFileCommand(currentText, button, onDiffSketchCreated)
42
+ executeEditFileCommand(currentText, button, panel, onDiffSketchCreated)
43
43
} else {
44
44
button.addActionListener {
45
- executeEditFileCommand(currentText, button, onDiffSketchCreated)
45
+ executeEditFileCommand(currentText, button, panel, onDiffSketchCreated)
46
46
}
47
47
}
48
48
@@ -65,6 +65,7 @@ class EditFileCommandProcessor(private val project: Project) {
65
65
private fun executeEditFileCommand (
66
66
currentText : String ,
67
67
button : JButton ,
68
+ panel : JPanel ,
68
69
onDiffSketchCreated : (SingleFileDiffSketch ) -> Unit
69
70
) {
70
71
val isAutoSketchMode = AutoSketchMode .getInstance(project).isEnable
@@ -74,22 +75,24 @@ class EditFileCommandProcessor(private val project: Project) {
74
75
75
76
executeEditFileCommandAsync(project, currentText) { result ->
76
77
runInEdt {
77
- handleExecutionResult(result, button, onDiffSketchCreated)
78
+ handleExecutionResult(result, button, panel, onDiffSketchCreated)
78
79
}
79
80
}
80
81
}
81
82
82
83
private fun handleExecutionResult (
83
84
result : EditResult ? ,
84
85
button : JButton ,
86
+ panel : JPanel ,
85
87
onDiffSketchCreated : (SingleFileDiffSketch ) -> Unit
86
88
) {
87
89
when (result) {
88
90
is EditResult .Success -> {
89
91
val diffSketch = createSingleFileDiffSketch(result.targetFile, result.patch)
90
92
onDiffSketchCreated(diffSketch)
91
- button.text = " Executed"
92
- button.icon = AllIcons .Actions .Checked
93
+ panel.remove(button)
94
+ panel.revalidate()
95
+ panel.repaint()
93
96
}
94
97
95
98
is EditResult .Error -> {
0 commit comments