mirror of
https://github.com/chylex/IntelliJ-AceJump.git
synced 2024-11-25 17:42:46 +01:00
Compare commits
3 Commits
d905909e31
...
9921409aff
Author | SHA1 | Date | |
---|---|---|---|
9921409aff | |||
|
3039b5fbb3 | ||
cb3d4559f9 |
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Add buttons to reset colors to default values in Settings, [#411](https://github.com/acejump/AceJump/issues/411)
|
||||||
|
|
||||||
## 3.8.16
|
## 3.8.16
|
||||||
|
|
||||||
- Fix issue with unselectable tags, [#446](https://github.com/acejump/AceJump/issues/446)
|
- Fix issue with unselectable tags, [#446](https://github.com/acejump/AceJump/issues/446)
|
||||||
|
@ -2,18 +2,14 @@ import org.jetbrains.changelog.Changelog.OutputType.HTML
|
|||||||
import org.jetbrains.changelog.date
|
import org.jetbrains.changelog.date
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
idea apply true
|
idea
|
||||||
kotlin("jvm") version "1.9.20-Beta"
|
kotlin("jvm") version "1.8.20" // https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
|
||||||
id("org.jetbrains.intellij") version "1.15.0"
|
id("org.jetbrains.intellij") version "1.15.0"
|
||||||
id("org.jetbrains.changelog") version "2.2.0"
|
id("org.jetbrains.changelog") version "2.2.0"
|
||||||
id("com.github.ben-manes.versions") version "0.48.0"
|
id("com.github.ben-manes.versions") version "0.48.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
compileKotlin {
|
|
||||||
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
|
|
||||||
}
|
|
||||||
|
|
||||||
named<Zip>("buildPlugin") {
|
named<Zip>("buildPlugin") {
|
||||||
dependsOn("test")
|
dependsOn("test")
|
||||||
archiveFileName = "AceJump.zip"
|
archiveFileName = "AceJump.zip"
|
||||||
@ -51,11 +47,7 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain {
|
jvmToolchain(17)
|
||||||
run {
|
|
||||||
languageVersion = JavaLanguageVersion.of(17)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sourceSets.all {
|
sourceSets.all {
|
||||||
languageSettings.apply {
|
languageSettings.apply {
|
||||||
languageVersion = "2.0"
|
languageVersion = "2.0"
|
||||||
|
@ -1 +1,4 @@
|
|||||||
|
kotlin.stdlib.default.dependency=false
|
||||||
|
kotlin.incremental.useClasspathSnapshot=false
|
||||||
|
|
||||||
org.gradle.jvmargs=-Xmx2048m
|
org.gradle.jvmargs=-Xmx2048m
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.acejump.config
|
package org.acejump.config
|
||||||
|
|
||||||
import com.intellij.openapi.ui.ComboBox
|
import com.intellij.openapi.ui.ComboBox
|
||||||
import com.intellij.ui.ColorPanel
|
|
||||||
import com.intellij.ui.components.*
|
import com.intellij.ui.components.*
|
||||||
import com.intellij.ui.dsl.builder.*
|
import com.intellij.ui.dsl.builder.*
|
||||||
import org.acejump.input.*
|
import org.acejump.input.JumpMode
|
||||||
|
import org.acejump.input.KeyLayout
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
import javax.swing.text.JTextComponent
|
import javax.swing.text.JTextComponent
|
||||||
@ -15,6 +15,8 @@ import kotlin.reflect.KProperty
|
|||||||
*/
|
*/
|
||||||
@Suppress("UsePropertyAccessSyntax")
|
@Suppress("UsePropertyAccessSyntax")
|
||||||
internal class AceSettingsPanel {
|
internal class AceSettingsPanel {
|
||||||
|
private val defaults = AceSettings()
|
||||||
|
|
||||||
private val tagCharsField = JBTextField()
|
private val tagCharsField = JBTextField()
|
||||||
private val keyboardLayoutCombo = ComboBox<KeyLayout>()
|
private val keyboardLayoutCombo = ComboBox<KeyLayout>()
|
||||||
private val keyboardLayoutArea = JBTextArea().apply { isEditable = false }
|
private val keyboardLayoutArea = JBTextArea().apply { isEditable = false }
|
||||||
@ -23,13 +25,13 @@ internal class AceSettingsPanel {
|
|||||||
private val cycleModeCombo3 = ComboBox<JumpMode>()
|
private val cycleModeCombo3 = ComboBox<JumpMode>()
|
||||||
private val cycleModeCombo4 = ComboBox<JumpMode>()
|
private val cycleModeCombo4 = ComboBox<JumpMode>()
|
||||||
private val minQueryLengthField = JBTextField()
|
private val minQueryLengthField = JBTextField()
|
||||||
private val jumpModeColorWheel = ColorPanel()
|
private val jumpModeColorWheel = ResettableColorPicker(defaults.getJumpModeJBC())
|
||||||
private val jumpEndModeColorWheel = ColorPanel()
|
private val jumpEndModeColorWheel = ResettableColorPicker(defaults.getJumpEndModeJBC())
|
||||||
private val targetModeColorWheel = ColorPanel()
|
private val targetModeColorWheel = ResettableColorPicker(defaults.getTargetModeJBC())
|
||||||
private val definitionModeColorWheel = ColorPanel()
|
private val definitionModeColorWheel = ResettableColorPicker(defaults.getDefinitionModeJBC())
|
||||||
private val textHighlightColorWheel = ColorPanel()
|
private val textHighlightColorWheel = ResettableColorPicker(defaults.getTextHighlightJBC())
|
||||||
private val tagForegroundColorWheel = ColorPanel()
|
private val tagForegroundColorWheel = ResettableColorPicker(defaults.getTagForegroundJBC())
|
||||||
private val tagBackgroundColorWheel = ColorPanel()
|
private val tagBackgroundColorWheel = ResettableColorPicker(defaults.getTagBackgroundJBC())
|
||||||
private val searchWholeFileCheckBox = JBCheckBox()
|
private val searchWholeFileCheckBox = JBCheckBox()
|
||||||
private val mapToASCIICheckBox = JBCheckBox()
|
private val mapToASCIICheckBox = JBCheckBox()
|
||||||
private val showSearchNotificationCheckBox = JBCheckBox()
|
private val showSearchNotificationCheckBox = JBCheckBox()
|
||||||
@ -133,8 +135,8 @@ internal class AceSettingsPanel {
|
|||||||
private operator fun JTextComponent.getValue(a: AceSettingsPanel, p: KProperty<*>) = text.lowercase()
|
private operator fun JTextComponent.getValue(a: AceSettingsPanel, p: KProperty<*>) = text.lowercase()
|
||||||
private operator fun JTextComponent.setValue(a: AceSettingsPanel, p: KProperty<*>, s: String) = setText(s)
|
private operator fun JTextComponent.setValue(a: AceSettingsPanel, p: KProperty<*>, s: String) = setText(s)
|
||||||
|
|
||||||
private operator fun ColorPanel.getValue(a: AceSettingsPanel, p: KProperty<*>) = selectedColor
|
private operator fun ResettableColorPicker.getValue(a: AceSettingsPanel, p: KProperty<*>) = getSelectedColor()
|
||||||
private operator fun ColorPanel.setValue(a: AceSettingsPanel, p: KProperty<*>, c: Color?) = setSelectedColor(c)
|
private operator fun ResettableColorPicker.setValue(a: AceSettingsPanel, p: KProperty<*>, c: Color?) = setSelectedColor(c)
|
||||||
|
|
||||||
private operator fun JCheckBox.getValue(a: AceSettingsPanel, p: KProperty<*>) = isSelected
|
private operator fun JCheckBox.getValue(a: AceSettingsPanel, p: KProperty<*>) = isSelected
|
||||||
private operator fun JCheckBox.setValue(a: AceSettingsPanel, p: KProperty<*>, selected: Boolean) = setSelected(selected)
|
private operator fun JCheckBox.setValue(a: AceSettingsPanel, p: KProperty<*>, selected: Boolean) = setSelected(selected)
|
||||||
|
47
src/main/kotlin/org/acejump/config/ResettableColorPicker.kt
Normal file
47
src/main/kotlin/org/acejump/config/ResettableColorPicker.kt
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package org.acejump.config
|
||||||
|
|
||||||
|
import com.intellij.icons.AllIcons
|
||||||
|
import com.intellij.openapi.actionSystem.*
|
||||||
|
import com.intellij.openapi.actionSystem.impl.ActionButton
|
||||||
|
import com.intellij.ui.ColorPanel
|
||||||
|
import com.intellij.ui.JBColor
|
||||||
|
import java.awt.*
|
||||||
|
import javax.swing.*
|
||||||
|
|
||||||
|
internal class ResettableColorPicker(private val defaultColor: JBColor) : JPanel(FlowLayout()) {
|
||||||
|
private val resetAction = object : AnAction({ "Reset to Default" }, AllIcons.General.Reset) {
|
||||||
|
override fun getActionUpdateThread(): ActionUpdateThread {
|
||||||
|
return ActionUpdateThread.EDT
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun update(e: AnActionEvent) {
|
||||||
|
e.presentation.isEnabled = colorPanel.selectedColor != defaultColor
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
|
setSelectedColor(defaultColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val colorPanel = ColorPanel()
|
||||||
|
private val resetButton = ActionButton(resetAction, null, ActionPlaces.UNKNOWN, ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE)
|
||||||
|
|
||||||
|
init {
|
||||||
|
add(colorPanel)
|
||||||
|
add(resetButton)
|
||||||
|
setSelectedColor(defaultColor)
|
||||||
|
|
||||||
|
colorPanel.addActionListener {
|
||||||
|
resetButton.update()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSelectedColor(): Color? {
|
||||||
|
return colorPanel.selectedColor
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setSelectedColor(color: Color?) {
|
||||||
|
colorPanel.selectedColor = color
|
||||||
|
resetButton.update()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user