summaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-05-09 00:41:36 +0300
committerKyren223 <ulmliad223@gmail.com>2024-05-09 00:41:36 +0300
commit1e30fa7ded9939fa45a45f82f84c1e8cd95d68aa (patch)
treef2b60d48330937603a8b068dbb5a983be33d8fb8 /src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt
parent5da72c7ec98edfab7fbebc335e1a9fba116988a5 (diff)
Refactored a lot of the code and added a bunch of features and settings. Not finished yet but committing, so I can push to GitHub
Diffstat (limited to 'src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt')
-rw-r--r--src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt b/src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt
deleted file mode 100644
index d098323..0000000
--- a/src/main/kotlin/me/kyren223/trident/PathMappingsMenu.kt
+++ /dev/null
@@ -1,63 +0,0 @@
-package me.kyren223.trident
-
-import com.intellij.openapi.editor.LogicalPosition
-import com.intellij.openapi.ui.DialogWrapper
-import com.intellij.ui.EditorTextField
-import com.maddyhome.idea.vim.api.injector
-import com.maddyhome.idea.vim.newapi.vim
-import java.awt.event.FocusEvent
-import java.awt.event.FocusListener
-import javax.swing.JComponent
-
-class PathMappingsMenu(private val content: String) : DialogWrapper(true) {
- private lateinit var editorTextField: EditorTextField
-
- init {
- val settings = SettingsState.instance
- this.title = "Trident Path Mappings Menu"
- setSize(settings.width, settings.height)
- super.init()
- }
-
- override fun createCenterPanel(): JComponent {
- val settings = SettingsState.instance
- editorTextField = EditorTextField(this.content)
- editorTextField.setOneLineMode(false)
- editorTextField.addSettingsProvider {
- it.setFontSize(settings.fontSize)
- it.isInsertMode = true
- it.caretModel.moveToLogicalPosition(LogicalPosition(0, 0))
- it.settings.isLineNumbersShown = true
- }
-
- editorTextField.addFocusListener(object : FocusListener {
- override fun focusGained(e: FocusEvent?) {
- val editor = editorTextField.editor!!.vim
- val context = injector.executionContextManager.onEditor(editor, null)
- simulateKeyPress("<ESC>", editor, context)
- }
-
- override fun focusLost(e: FocusEvent?) { /* Do nothing */ }
- })
-
- return editorTextField
- }
-
- override fun getPreferredFocusedComponent(): JComponent {
- return this.editorTextField
- }
-
- override fun doOKAction() {
- TridentState.pathMappingsContent = editorTextField.text
- super.doOKAction()
- }
-
- override fun doCancelAction() {
- TridentState.pathMappingsContent = editorTextField.text
- super.doCancelAction()
- }
-
- override fun createSouthPanel(): JComponent? {
- return null
- }
-}