summaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-02-22 22:34:10 +0200
committerKyren223 <ulmliad223@gmail.com>2024-02-22 22:34:10 +0200
commit02b1533ff4002f1015b9c26cf69256d821ddb6b1 (patch)
treea53ba1aed8abd703eb6c47164f1b5a553d3b09c0 /src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt
parent883fd7f58b2ef0254cb3c3fa79cc24f6dcdf9efd (diff)
Rebranded to "Trident"
Diffstat (limited to 'src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt')
-rw-r--r--src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt b/src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt
deleted file mode 100644
index 3c196b8..0000000
--- a/src/main/kotlin/me/kyren223/harpoonforjb/HarpoonSelectAction.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-package me.kyren223.harpoonforjb
-
-import com.intellij.openapi.actionSystem.AnAction
-import com.intellij.openapi.actionSystem.AnActionEvent
-import com.intellij.openapi.actionSystem.PlatformDataKeys
-import com.intellij.openapi.fileEditor.FileEditorManager
-
-class HarpoonSelectAction : AnAction() {
- override fun actionPerformed(e: AnActionEvent) {
- val project = e.project ?: return
- val actionId = e.actionManager.getId(this)
- var index = when (actionId) {
- NEXT -> {
- val current = HarpoonState.getIndexOfFile(project, e.getData(PlatformDataKeys.VIRTUAL_FILE))
- if (current == -1) return
- current + 1
- }
- PREV -> {
- val current = HarpoonState.getIndexOfFile(project, e.getData(PlatformDataKeys.VIRTUAL_FILE))
- if (current == -1) return
- current - 1
- }
- else -> {
- getIndex(actionId)
- }
- }
-
- val count = HarpoonState.getFileCount(project)
- index = ((index % count) + count) % count
- val file = HarpoonState.selectFile(project, index) ?: return
- FileEditorManager.getInstance(project).openFile(file, true)
- }
-
- private fun getIndex(actionId: String): Int {
- return actionId.substring(SELECT.length).toInt() - 1
- }
-
- companion object {
- const val NEXT = "HarpoonSelectNext"
- const val PREV = "HarpoonSelectPrev"
- const val SELECT = "HarpoonSelect"
- }
-}
-