summaryrefslogtreecommitdiff
path: root/src/main/kotlin/me/kyren223/trident/data/TridentState.kt
diff options
context:
space:
mode:
authorKyren223 <ulmliad223@gmail.com>2024-05-09 18:09:24 +0300
committerKyren223 <ulmliad223@gmail.com>2024-05-09 18:09:24 +0300
commit9b9c0f0594209b8c4ecdb7901293734ccf567437 (patch)
tree0843cb07aa00ce80418f01a1ad083f72e45d7d93 /src/main/kotlin/me/kyren223/trident/data/TridentState.kt
parent1e30fa7ded9939fa45a45f82f84c1e8cd95d68aa (diff)
Finished implementing all the settings, mapping menu, trident list menu, and fixed all the bugs/issues.
Added more index actions for a total of 10 actions (compared to the original 4). Updated README.md and TODO.md. Changed version to 2.0.0. Versions now follow the semver standard. which means that for each major version there will be backwards incompatible changes. for minor versions there will be new features and bug fixes. and for patch versions there will be bug fixes only.
Diffstat (limited to 'src/main/kotlin/me/kyren223/trident/data/TridentState.kt')
-rw-r--r--src/main/kotlin/me/kyren223/trident/data/TridentState.kt181
1 files changed, 0 insertions, 181 deletions
diff --git a/src/main/kotlin/me/kyren223/trident/data/TridentState.kt b/src/main/kotlin/me/kyren223/trident/data/TridentState.kt
deleted file mode 100644
index 54529e9..0000000
--- a/src/main/kotlin/me/kyren223/trident/data/TridentState.kt
+++ /dev/null
@@ -1,181 +0,0 @@
-package me.kyren223.trident.data
-
-//object TridentState {
-// private const val TRIDENT_LIST_KEY = "TridentList"
-// private const val TRIDENT_MAPPINGS_KEY = "TridentMappings"
-//
-// private var list: MutableMap<String, MutableList<VirtualFile>> = mutableMapOf()
-// private var mappings: MutableMap<String, MutableMap<String, String>> = mutableMapOf()
-//
-// private var quickMenu: QuickMenu? = null
-// var quickMenuSelectedIndex: Int? = null
-// var quickMenuContent: String = ""
-// private var pathMappingsMenu: PathMappingsMenu? = null
-// var pathMappingsContent: String = ""
-//
-//// fun appendFile(project: Project, file: VirtualFile) {
-//// if (!file.isValid) return
-//// loadProject(project)
-//// val files = list[project.name]
-//// files!!.add(file)
-//// saveProject(project)
-//// }
-//
-//// fun selectFile(project: Project, index: Int): VirtualFile? {
-//// if (index < 0) return null
-//// loadProject(project)
-//// val files = list[project.name]
-//// if (files!!.size <= index) return null
-//// return files[index]
-//// }
-//
-//// private fun loadProject(project: Project) {
-//// if (project.name in list) return
-//// val properties = PropertiesComponent.getInstance(project)
-////
-//// val pathMappingsList = properties.getList(TRIDENT_MAPPINGS_KEY)
-//// var map = mutableMapOf<String, String>()
-//// if (pathMappingsList == null) {
-//// map["..."] = project.basePath!!
-//// } else {
-//// for (entry in pathMappingsList) {
-//// val split = entry.split("=")
-//// if (split.size != 2) continue
-//// map[split[0]] = split[1]
-//// }
-//// }
-//// mappings[project.name] = map
-////
-//// val list = properties.getList(TRIDENT_LIST_KEY)
-//// if (list == null) {
-//// this.list[project.name] = mutableListOf()
-//// } else {
-//// val fs = LocalFileSystem.getInstance()
-//// val files = list.stream()
-//// .map { fs.findFileByPath(it) }
-//// .toList()
-//// .filterNotNull()
-//// .filter { it.isValid }
-//// .toMutableList()
-//// this.list[project.name] = files
-//// }
-//// }
-//
-//// private fun saveProject(project: Project) {
-//// if (project.name !in list) return
-//// val files = list[project.name]
-//// val properties = PropertiesComponent.getInstance(project)
-////
-//// val stringList = files!!.stream()
-//// .filter { it.isValid }
-//// .map { it.path }
-//// .toList()
-//// properties.setList(TRIDENT_LIST_KEY, stringList)
-////
-//// val pathMappingsString = mappings[project.name]!!.entries
-//// .joinToString("\n") { "${it.key}=${it.value}" }
-//// .split("\n")
-//// properties.setList(TRIDENT_MAPPINGS_KEY, pathMappingsString)
-//// }
-//
-//// fun getIndexOfFile(project: Project, data: VirtualFile?): Int {
-//// loadProject(project)
-//// val files = list[project.name]
-//// if (files == null || data == null) return -1
-//// return files.indexOfFirst { it.path == data.path }
-//// }
-//
-//// fun getFileCount(project: Project): Int {
-//// loadProject(project)
-//// return list[project.name]!!.size
-//// }
-//
-// fun toggleQuickMenu(project: Project) {
-// if (quickMenu != null && quickMenu!!.isShowing) {
-// quickMenu!!.doCancelAction()
-// return
-// }
-//
-//// loadProject(project)
-// val content = TridentList.get(project).joinToString("\n")
-// quickMenu = QuickMenu(content)
-// val result = quickMenu!!.showAndGet()
-//
-// if (content != quickMenuContent) {
-// retrieveProjectFiles(project, quickMenuContent)
-//// saveProject(project)
-// }
-//
-// if (!result) return
-// val index = quickMenuSelectedIndex ?: return
-// quickMenuSelectedIndex = null
-// val file = TridentList.select(project, index) ?: return
-// FileEditorManager.getInstance(project).openFile(file, true)
-// }
-//
-// fun quickMenuSelect() {
-// if (quickMenu == null || !quickMenu!!.isShowing) return
-// quickMenu!!.select()
-// }
-//
-//// private fun getProjectContent(project: Project): String {
-//// loadProject(project)
-//// val map = mappings[project.name] ?: throw IllegalStateException("Path mappings not found")
-//// println("map: $map")
-//// var content = list[project.name]!!
-//// .joinToString("\n") { it.path }
-//// .trim()
-//// println("content: $content")
-//// for ((key, value) in map) {
-//// println("key: $key | value: $value")
-//// content = content.replace(value, key)
-//// }
-//// println("content: $content")
-//// return content
-//// }
-//
-//// private fun retrieveProjectFiles(project: Project, content: String) {
-//// loadProject(project)
-//// val files = content
-//// .split("\n")
-//// .asSequence()
-//// .map { it.trim() }
-//// .map { line ->
-//// mappings[project.name]!!.entries.fold(line) { acc, (key, value) ->
-//// acc.replace(key, value)
-//// }
-//// }
-////// .map {
-////// pathMappings[project.name]!!.entries.forEach { (key, value) -> it.replace(key, value) }
-////// it
-////// }
-//// .filter { it.isNotBlank() }
-//// .map { LocalFileSystem.getInstance().findFileByPath(it) }
-//// .filterNotNull()
-//// .filter { it.isValid }
-//// .toMutableList()
-//// list[project.name] = files
-//// }
-//
-// fun togglePathMappingsMenu(project: Project) {
-// if (pathMappingsMenu != null && pathMappingsMenu!!.isShowing) {
-// pathMappingsMenu!!.doCancelAction()
-// return
-// }
-//
-//// loadProject(project)
-// val content = mappings[project.name]!!.entries
-// .joinToString("\n") { "${it.key}=${it.value}" }
-// pathMappingsMenu = PathMappingsMenu(content)
-// pathMappingsMenu!!.showAndGet()
-//
-// if (content != pathMappingsContent) {
-// pathMappingsContent.split("\n").forEach {
-// val split = it.split("=")
-// if (split.size != 2) return@forEach
-// mappings[project.name]!![split[0]] = split[1]
-// }
-//// saveProject(project)
-// }
-// }
-//} \ No newline at end of file