Allow user to finish input by pressing return
This commit is contained in:
parent
13fb76bc26
commit
531a8a1b6f
|
|
@ -8,6 +8,8 @@ import com.intellij.openapi.ui.popup.JBPopupListener
|
||||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent
|
import com.intellij.openapi.ui.popup.LightweightWindowEvent
|
||||||
import com.intellij.ui.components.JBTextField
|
import com.intellij.ui.components.JBTextField
|
||||||
import java.awt.FlowLayout
|
import java.awt.FlowLayout
|
||||||
|
import java.awt.event.ActionEvent
|
||||||
|
import java.awt.event.ActionListener
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
|
|
||||||
class FilenameTemplateAction : AnAction() {
|
class FilenameTemplateAction : AnAction() {
|
||||||
|
|
@ -16,6 +18,13 @@ class FilenameTemplateAction : AnAction() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
filenameTemplateField.columns = 20
|
filenameTemplateField.columns = 20
|
||||||
|
filenameTemplateField.addActionListener(AddStatusClickListener())
|
||||||
|
}
|
||||||
|
|
||||||
|
private inner class AddStatusClickListener : ActionListener {
|
||||||
|
override fun actionPerformed(e: ActionEvent) {
|
||||||
|
filenameTemplatePopup!!.closeOk(null)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun actionPerformed(event: AnActionEvent) {
|
override fun actionPerformed(event: AnActionEvent) {
|
||||||
|
|
@ -33,11 +42,14 @@ class FilenameTemplateAction : AnAction() {
|
||||||
.createPopup()
|
.createPopup()
|
||||||
|
|
||||||
val listener = object : JBPopupListener {
|
val listener = object : JBPopupListener {
|
||||||
|
|
||||||
override fun onClosed(e: LightweightWindowEvent) {
|
override fun onClosed(e: LightweightWindowEvent) {
|
||||||
super.onClosed(e)
|
super.onClosed(e)
|
||||||
if (e.isOk) {
|
if (e.isOk) {
|
||||||
|
NotificationGroupManager
|
||||||
|
.getInstance()
|
||||||
|
.getNotificationGroup("Filename Template Notification Group")
|
||||||
|
.createNotification(filenameTemplateField.text, NotificationType.INFORMATION)
|
||||||
|
.notify(event.project)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user