From 7451f83d6685073d10df9bae5c957fdb55dcdc53 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Fri, 23 Aug 2024 00:31:20 +0300 Subject: fix: issues with IdeaVim version 2.16.0, everything should work now --- .../me/kyren223/trident/ui/SettingsConfigurable.kt | 134 ++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) (limited to 'src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt') diff --git a/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt b/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt index f6979b1..085c6f2 100644 --- a/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt +++ b/src/main/kotlin/me/kyren223/trident/ui/SettingsConfigurable.kt @@ -1,67 +1,67 @@ -// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package me.kyren223.trident.ui - -import com.intellij.openapi.options.Configurable -import com.intellij.openapi.util.NlsContexts.ConfigurableName -import me.kyren223.trident.data.SettingsData -import me.kyren223.trident.data.SettingsState -import javax.swing.JComponent - -class SettingsConfigurable : Configurable { - - private var settings: SettingsData? = null - - override fun getDisplayName(): @ConfigurableName String { - return "Trident Settings" - } - - override fun createComponent(): JComponent { - settings = SettingsData() - return settings!!.panel - } - - override fun isModified(): Boolean { - val settings = SettingsState.instance - if (settings.width != this.settings!!.getWidth()) return true - if (settings.height != this.settings!!.getHeight()) return true - if (settings.fontSize != this.settings!!.getFontSize()) return true - if (settings.enterToSelect != this.settings!!.getEnterToSelect()) return true - if (settings.automaticMapping != this.settings!!.getAutomaticMapping()) return true - if (settings.automaticReplacing != this.settings!!.getAutomaticReplacing()) return true - if (settings.recursiveMapping != this.settings!!.getRecursiveMapping()) return true - if (settings.rememberLine != this.settings!!.getRememberLine()) return true - if (settings.indexCycling != this.settings!!.getIndexCycling()) return true - return false - } - - override fun apply() { - val settings = SettingsState.instance - settings.width = this.settings!!.getWidth() - settings.height = this.settings!!.getHeight() - settings.fontSize = this.settings!!.getFontSize() - settings.enterToSelect = this.settings!!.getEnterToSelect() - settings.automaticMapping = this.settings!!.getAutomaticMapping() - settings.automaticReplacing = this.settings!!.getAutomaticReplacing() - settings.recursiveMapping = this.settings!!.getRecursiveMapping() - settings.rememberLine = this.settings!!.getRememberLine() - settings.indexCycling = this.settings!!.getIndexCycling() - } - - override fun reset() { - val settings = SettingsState.instance - if (this.settings == null) this.settings = SettingsData() - this.settings!!.setWidth(settings.width) - this.settings!!.setHeight(settings.height) - this.settings!!.setFontSize(settings.fontSize) - this.settings!!.setEnterToSelect(settings.enterToSelect) - this.settings!!.setAutomaticMapping(settings.automaticMapping) - this.settings!!.setAutomaticReplacing(settings.automaticReplacing) - this.settings!!.setRecursiveMapping(settings.recursiveMapping) - this.settings!!.setRememberLine(settings.rememberLine) - this.settings!!.setIndexCycling(settings.indexCycling) - } - - override fun disposeUIResources() { - settings = null - } -} +// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +package me.kyren223.trident.ui + +import com.intellij.openapi.options.Configurable +import com.intellij.openapi.util.NlsContexts.ConfigurableName +import me.kyren223.trident.data.SettingsData +import me.kyren223.trident.data.SettingsState +import javax.swing.JComponent + +class SettingsConfigurable : Configurable { + + private var settings: SettingsData? = null + + override fun getDisplayName(): @ConfigurableName String { + return "Trident Settings" + } + + override fun createComponent(): JComponent { + settings = SettingsData() + return settings!!.panel + } + + override fun isModified(): Boolean { + val settings = SettingsState.instance + if (settings.width != this.settings!!.getWidth()) return true + if (settings.height != this.settings!!.getHeight()) return true + if (settings.fontSize != this.settings!!.getFontSize()) return true + if (settings.enterToSelect != this.settings!!.getEnterToSelect()) return true + if (settings.automaticMapping != this.settings!!.getAutomaticMapping()) return true + if (settings.automaticReplacing != this.settings!!.getAutomaticReplacing()) return true + if (settings.recursiveMapping != this.settings!!.getRecursiveMapping()) return true + if (settings.rememberLine != this.settings!!.getRememberLine()) return true + if (settings.indexCycling != this.settings!!.getIndexCycling()) return true + return false + } + + override fun apply() { + val settings = SettingsState.instance + settings.width = this.settings!!.getWidth() + settings.height = this.settings!!.getHeight() + settings.fontSize = this.settings!!.getFontSize() + settings.enterToSelect = this.settings!!.getEnterToSelect() + settings.automaticMapping = this.settings!!.getAutomaticMapping() + settings.automaticReplacing = this.settings!!.getAutomaticReplacing() + settings.recursiveMapping = this.settings!!.getRecursiveMapping() + settings.rememberLine = this.settings!!.getRememberLine() + settings.indexCycling = this.settings!!.getIndexCycling() + } + + override fun reset() { + val settings = SettingsState.instance + if (this.settings == null) this.settings = SettingsData() + this.settings!!.setWidth(settings.width) + this.settings!!.setHeight(settings.height) + this.settings!!.setFontSize(settings.fontSize) + this.settings!!.setEnterToSelect(settings.enterToSelect) + this.settings!!.setAutomaticMapping(settings.automaticMapping) + this.settings!!.setAutomaticReplacing(settings.automaticReplacing) + this.settings!!.setRecursiveMapping(settings.recursiveMapping) + this.settings!!.setRememberLine(settings.rememberLine) + this.settings!!.setIndexCycling(settings.indexCycling) + } + + override fun disposeUIResources() { + settings = null + } +} -- cgit v1.3.1