diff options
| -rw-r--r-- | .idea/gradle.xml | 2 | ||||
| -rw-r--r-- | .idea/inspectionProfiles/Project_Default.xml | 8 | ||||
| -rw-r--r-- | .idea/misc.xml | 1 | ||||
| -rw-r--r-- | .idea/vcs.xml | 6 | ||||
| -rw-r--r-- | build.gradle.kts | 6 | ||||
| -rw-r--r-- | settings.gradle.kts | 3 | ||||
| -rw-r--r-- | src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsConfigurable.kt | 47 | ||||
| -rw-r--r-- | src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsState.kt | 29 | ||||
| -rw-r--r-- | src/main/kotlin/me/kyren223/harpoonforjb/SettingsData.kt | 47 | ||||
| -rw-r--r-- | src/main/kotlin/me/kyren223/harpoonforjb/State.java | 4 | ||||
| -rw-r--r-- | src/main/resources/META-INF/HarpoonForJB-IdeaVim.xml | 2 | ||||
| -rw-r--r-- | src/main/resources/META-INF/plugin.xml | 11 |
12 files changed, 154 insertions, 12 deletions
diff --git a/.idea/gradle.xml b/.idea/gradle.xml index f9163b4..9c7e385 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> + <component name="GradleMigrationSettings" migrationVersion="1" /> <component name="GradleSettings"> <option name="linkedExternalProjectsSettings"> <GradleProjectSettings> @@ -7,6 +8,7 @@ <option name="modules"> <set> <option value="$PROJECT_DIR$" /> + <option value="$PROJECT_DIR$/IdeaVIM" /> </set> </option> </GradleProjectSettings> diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..2520c75 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,8 @@ +<component name="InspectionProjectProfileManager"> + <profile version="1.0"> + <option name="myName" value="Project Default" /> + <inspection_tool class="TrivialIf" enabled="true" level="WARNING" enabled_by_default="true"> + <option name="ignoreChainedIf" value="true" /> + </inspection_tool> + </profile> +</component>
\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e8d2d64..61d342f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ -<?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK"> diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project>
\ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 882f8b3..7824a69 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,10 +14,10 @@ repositories { // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - version.set("2022.2.5") + version.set("2023.1") type.set("IC") // Target IDE Platform - - plugins.set(listOf(/* Plugin Dependencies */)) + updateSinceUntilBuild.set(false) + plugins.set(listOf("IdeaVim:2.7.5")) } tasks { diff --git a/settings.gradle.kts b/settings.gradle.kts index c07ab2f..d2d2145 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,4 +5,5 @@ pluginManagement { } } -rootProject.name = "HarpoonForJB"
\ No newline at end of file +rootProject.name = "HarpoonForJB" +include("IdeaVIM")
\ No newline at end of file diff --git a/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsConfigurable.kt b/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsConfigurable.kt new file mode 100644 index 0000000..5d50bb9 --- /dev/null +++ b/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsConfigurable.kt @@ -0,0 +1,47 @@ +// 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.harpoonforjb + +import com.intellij.openapi.options.Configurable +import com.intellij.openapi.util.NlsContexts.ConfigurableName +import javax.swing.JComponent + +class AppSettingsConfigurable : Configurable { + private var settings: SettingsData? = null + override fun getDisplayName(): @ConfigurableName String { + return "HarpoonForJB Settings" + } + + override fun createComponent(): JComponent { + settings = SettingsData() + return settings!!.panel + } + + override fun isModified(): Boolean { + val settings = AppSettingsState.instance + if (settings.harpoonWidth != this.settings!!.getHarpoonWidth()) return true + if (settings.harpoonHeight != this.settings!!.getHarpoonHeight()) return true + if (settings.harpoonFontSize != this.settings!!.getHarpoonFontSize()) return true + return false + } + + override fun apply() { + val settings = AppSettingsState.instance + settings.harpoonWidth = this.settings!!.getHarpoonWidth() + settings.harpoonHeight = this.settings!!.getHarpoonHeight() + settings.harpoonFontSize = this.settings!!.getHarpoonFontSize() + } + + override fun reset() { + val settings = AppSettingsState.instance + if (this.settings == null) { + this.settings = SettingsData() + } + this.settings!!.setHarpoonWidth(settings.harpoonWidth) + this.settings!!.setHarpoonHeight(settings.harpoonHeight) + this.settings!!.setHarpoonFontSize(settings.harpoonFontSize) + } + + override fun disposeUIResources() { + settings = null + } +} diff --git a/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsState.kt b/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsState.kt new file mode 100644 index 0000000..5699d53 --- /dev/null +++ b/src/main/kotlin/me/kyren223/harpoonforjb/AppSettingsState.kt @@ -0,0 +1,29 @@ +package me.kyren223.harpoonforjb + +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.PersistentStateComponent +import com.intellij.openapi.components.State +import com.intellij.openapi.components.Storage +import com.intellij.util.xmlb.XmlSerializerUtil + +// 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. +@State(name = "me.kyren223.harpoonforjb.AppSettingsState", storages = [Storage("SdkSettingsPlugin.xml")]) +class AppSettingsState : PersistentStateComponent<AppSettingsState?> { + + var harpoonWidth = 800 + var harpoonHeight = 400 + var harpoonFontSize = 20 + + override fun getState(): AppSettingsState { + return this + } + + override fun loadState(state: AppSettingsState) { + XmlSerializerUtil.copyBean(state, this) + } + + companion object { + val instance: AppSettingsState + get() = ApplicationManager.getApplication().getService(AppSettingsState::class.java) + } +} diff --git a/src/main/kotlin/me/kyren223/harpoonforjb/SettingsData.kt b/src/main/kotlin/me/kyren223/harpoonforjb/SettingsData.kt new file mode 100644 index 0000000..3749661 --- /dev/null +++ b/src/main/kotlin/me/kyren223/harpoonforjb/SettingsData.kt @@ -0,0 +1,47 @@ +package me.kyren223.harpoonforjb + +import com.intellij.ui.JBIntSpinner +import com.intellij.ui.components.JBLabel +import com.intellij.util.ui.FormBuilder +import javax.swing.JPanel + +class SettingsData { + + val panel: JPanel + private val harpoonWidth: JBIntSpinner = JBIntSpinner(800, 1, 5000, 10) + private val harpoonHeight: JBIntSpinner = JBIntSpinner(400, 1, 5000, 10) + private val harpoonFontSize: JBIntSpinner = JBIntSpinner(20, 1, 100) + + init { + panel = FormBuilder.createFormBuilder() + .addLabeledComponent(JBLabel("Harpoon width"), harpoonWidth, 1, false) + .addLabeledComponent(JBLabel("Harpoon height"), harpoonHeight, 1, false) + .addLabeledComponent(JBLabel("Harpoon font size"), harpoonFontSize, 1, false) + .addComponentFillVertically(JPanel(), 0) + .panel + } + + fun getHarpoonWidth(): Int { + return harpoonWidth.number + } + + fun getHarpoonHeight(): Int { + return harpoonHeight.number + } + + fun getHarpoonFontSize(): Int { + return harpoonFontSize.number + } + + fun setHarpoonWidth(width: Int) { + harpoonWidth.number = width + } + + fun setHarpoonHeight(height: Int) { + harpoonHeight.number = height + } + + fun setHarpoonFontSize(fontSize: Int) { + harpoonFontSize.number = fontSize + } +} diff --git a/src/main/kotlin/me/kyren223/harpoonforjb/State.java b/src/main/kotlin/me/kyren223/harpoonforjb/State.java deleted file mode 100644 index 3996786..0000000 --- a/src/main/kotlin/me/kyren223/harpoonforjb/State.java +++ /dev/null @@ -1,4 +0,0 @@ -package me.kyren223.harpoonforjb; - -public class State { -} diff --git a/src/main/resources/META-INF/HarpoonForJB-IdeaVim.xml b/src/main/resources/META-INF/HarpoonForJB-IdeaVim.xml new file mode 100644 index 0000000..164f46c --- /dev/null +++ b/src/main/resources/META-INF/HarpoonForJB-IdeaVim.xml @@ -0,0 +1,2 @@ +<idea-plugin> +</idea-plugin> diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 2aca8f6..7469358 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ <!-- Plugin Configuration File. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-configuration-file.html --> <idea-plugin> <!-- Unique identifier of the plugin. It should be FQN. It cannot be changed between the plugin versions. --> - <id>me.kyren223.HarpoonForJB</id> + <id>me.kyren223.harpoonforjb</id> <!-- Public plugin name should be written in Title Case. Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-name --> @@ -27,10 +27,15 @@ <!-- Product and plugin compatibility requirements. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html --> <depends>com.intellij.modules.platform</depends> - + <depends optional="true" config-file="HarpoonForJB-IdeaVim.xml">IdeaVIM</depends> <!-- Extension points defined by the plugin. Read more: https://plugins.jetbrains.com/docs/intellij/plugin-extension-points.html --> <extensions defaultExtensionNs="com.intellij"> - + <applicationConfigurable + parentId="tools" + instance="me.kyren223.harpoonforjb.AppSettingsConfigurable" + id="me.kyren223.harpoonforjb.AppSettingsConfigurable" + displayName="HarpoonForJB Settings"/> + <applicationService serviceImplementation="me.kyren223.harpoonforjb.AppSettingsState"/> </extensions> </idea-plugin>
\ No newline at end of file |
