1
0
mirror of https://github.com/chylex/IntelliJ-AceJump.git synced 2025-05-11 10:34:05 +02:00

use BGT and migrate awt.Color to JBColor

This commit is contained in:
breandan 2023-02-13 18:45:18 -05:00
parent e939479368
commit ba739501e8
6 changed files with 28 additions and 41 deletions

View File

@ -187,8 +187,8 @@ The following plugins have a similar UI for navigating text and web browsing:
| [avy](https://github.com/abo-abo/avy) | [](https://melpa.org/#/avy) | [emacs](https://www.gnu.org/software/emacs/) | :heavy_check_mark: | [Emacs Lisp](https://www.gnu.org/software/emacs/manual/eintr.html) |
| [EasyMotion](https://github.com/easymotion/vim-easymotion) | [](https://vimawesome.com/plugin/easymotion) | [Vim](http://www.vim.org/) | :x: | [Vimscript](http://learnvimscriptthehardway.stevelosh.com/) |
| [Hop](https://github.com/phaazon/hop.nvim) | [](https://github.com/phaazon/hop.nvim#installation) | [NeoVim](https://neovim.io/) | :heavy_check_mark: | [Lua](https://www.lua.org/) |
| [leap.nvim](https://github.com/ggandor/leap.nvim) | [](https://github.com/ggandor/leap.nvim#installation) | [NeoVim](https://neovim.io/) | :heavy_check_mark: | [Fennel](https://fennel-lang.org) |
| [lightspeed.nvim](https://github.com/ggandor/lightspeed.nvim) | [](https://github.com/ggandor/lightspeed.nvim#installation) | [NeoVim](https://neovim.io/) | :x: | [Fennel](https://fennel-lang.org) |
| [leap.nvim](https://github.com/ggandor/leap.nvim) | [](https://github.com/ggandor/leap.nvim#installation) | [NeoVim](https://neovim.io/) | :heavy_check_mark: | [Fennel](https://fennel-lang.org) |
| [lightspeed.nvim](https://github.com/ggandor/lightspeed.nvim) | [](https://github.com/ggandor/lightspeed.nvim#installation) | [NeoVim](https://neovim.io/) | :x: | [Fennel](https://fennel-lang.org) |
| [Sublime EasyMotion](https://github.com/tednaleid/sublime-EasyMotion) | [](https://packagecontrol.io/packages/EasyMotion) | [Sublime](https://www.sublimetext.com/) | :x: | [Python](https://www.python.org/) |
| [AceJump](https://github.com/ice9js/ace-jump-sublime) | [](https://packagecontrol.io/packages/AceJump) | [Sublime](https://www.sublimetext.com/) | :x: | [Python](https://www.python.org/) |
| [Jumpy](https://github.com/DavidLGoldberg/jumpy) | [](https://atom.io/packages/jumpy) | [Atom](https://atom.io/) | :heavy_check_mark: | [TypeScript](https://www.typescriptlang.org/) |
@ -206,7 +206,7 @@ The following plugins have a similar UI for navigating text and web browsing:
| [ViChrome](https://github.com/k2nr/ViChrome) | [](https://chrome.google.com/webstore/detail/vichrome/gghkfhpblkcmlkmpcpgaajbbiikbhpdi) | [Chrome](https://www.google.com/chrome) | :x: | [CoffeeScript](http://coffeescript.org/) |
| [VimFx](https://github.com/akhodakivskiy/VimFx) | [](https://github.com/akhodakivskiy/VimFx/releases) | [Firefox](https://www.mozilla.org/firefox) | :heavy_check_mark: | [CoffeeScript](http://coffeescript.org/) |
| [Vimperator](https://github.com/vimperator/vimperator-labs/) | [](https://github.com/vimperator/vimperator-labs/releases) | [Firefox](https://www.mozilla.org/firefox) | :x: | [JavaScript](https://www.javascript.com/) |
| [Pentadactyl](https://github.com/5digits/dactyl) | [](http://bug.5digits.org/pentadactyl/#sect-download) | [Firefox](https://www.mozilla.org/firefox) | :x: | [JavaScript](https://www.typescriptlang.org/) |
| [Pentadactyl](https://github.com/5digits/dactyl) | [](http://bug.5digits.org/pentadactyl/#sect-download) | [Firefox](https://www.mozilla.org/firefox) | :x: | [JavaScript](https://www.typescriptlang.org/) |
| [Vim Vixen](https://github.com/ueokande/vim-vixen) | [](https://addons.mozilla.org/firefox/addon/vim-vixen/) | [Firefox 57+](https://blog.mozilla.org/addons/2017/09/28/webextensions-in-firefox-57/) | :heavy_check_mark: | [JavaScript](https://www.javascript.com/) |
| [Tridactyl](https://github.com/tridactyl/tridactyl) | [](https://addons.mozilla.org/firefox/addon/tridactyl-vim/) | [Firefox 57+](https://blog.mozilla.org/addons/2017/09/28/webextensions-in-firefox-57/) | :heavy_check_mark: | [TypeScript](https://www.typescriptlang.org/) |
| [Vimari](https://github.com/guyht/vimari) | [](https://github.com/guyht/vimari/releases) | [Safari](https://www.apple.com/safari/) | :heavy_check_mark: | [JavaScript](https://www.javascript.com/) |

View File

@ -1,6 +1,5 @@
import org.jetbrains.changelog.*
import org.jetbrains.changelog.Changelog.OutputType.HTML
import org.jetbrains.intellij.tasks.*
import org.jetbrains.changelog.date
plugins {
idea apply true

View File

@ -1,6 +1,6 @@
package org.acejump.action
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.actionSystem.CommonDataKeys.EDITOR
import com.intellij.openapi.fileEditor.TextEditor
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
@ -19,6 +19,8 @@ import org.acejump.session.SessionManager
* Base class for keyboard-activated actions that create or update an AceJump [Session].
*/
sealed class AceAction: DumbAwareAction() {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
final override fun update(action: AnActionEvent) {
action.presentation.isEnabled = action.getData(EDITOR) != null
}

View File

@ -1,6 +1,7 @@
package org.acejump.config
import com.intellij.openapi.options.Configurable
import com.intellij.ui.JBColor
import org.acejump.config.AceConfig.Companion.settings
import org.acejump.input.KeyLayoutCache
@ -38,13 +39,13 @@ class AceConfigurable: Configurable {
settings.cycleMode3 = panel.cycleMode3
settings.cycleMode4 = panel.cycleMode4
settings.minQueryLength = panel.minQueryLengthInt ?: settings.minQueryLength
panel.jumpModeColor?.let { settings.jumpModeColor = it }
panel.jumpEndModeColor?.let { settings.jumpEndModeColor = it }
panel.targetModeColor?.let { settings.targetModeColor = it }
panel.definitionModeColor?.let { settings.definitionModeColor = it }
panel.textHighlightColor?.let { settings.textHighlightColor = it }
panel.tagForegroundColor?.let { settings.tagForegroundColor = it }
panel.tagBackgroundColor?.let { settings.tagBackgroundColor = it }
panel.jumpModeColor?.let { settings.jumpModeColor = JBColor.namedColor("jumpModeRGB", it) }
panel.jumpEndModeColor?.let { settings.jumpEndModeColor = JBColor.namedColor("jumpEndModeRGB", it) }
panel.targetModeColor?.let { settings.targetModeColor = JBColor.namedColor("targetModeRGB", it) }
panel.definitionModeColor?.let { settings.definitionModeColor = JBColor.namedColor("definitionModeRGB", it) }
panel.textHighlightColor?.let { settings.textHighlightColor = JBColor.namedColor("textHighlightRGB", it) }
panel.tagForegroundColor?.let { settings.tagForegroundColor = JBColor.namedColor("tagForegroundRGB", it) }
panel.tagBackgroundColor?.let { settings.tagBackgroundColor = JBColor.namedColor("tagBackgroundRGB", it) }
settings.searchWholeFile = panel.searchWholeFile
settings.mapToASCII = panel.mapToASCII
settings.showSearchNotification = panel.showSearchNotification

View File

@ -1,11 +1,8 @@
package org.acejump.config
import com.intellij.util.xmlb.Converter
import com.intellij.util.xmlb.annotations.OptionTag
import org.acejump.input.JumpMode
import org.acejump.input.KeyLayout
import com.intellij.ui.JBColor
import org.acejump.input.*
import org.acejump.input.KeyLayout.QWERTY
import java.awt.Color
data class AceSettings(
var layout: KeyLayout = QWERTY,
@ -16,35 +13,23 @@ data class AceSettings(
var cycleMode4: JumpMode = JumpMode.JUMP_END,
var minQueryLength: Int = 1,
@OptionTag("jumpModeRGB", converter = ColorConverter::class)
var jumpModeColor: Color = Color(0xFFFFFF),
var jumpModeColor: JBColor = JBColor.namedColor("jumpModeRGB", 0xFFFFFF),
@OptionTag("jumpEndModeRGB", converter = ColorConverter::class)
var jumpEndModeColor: Color = Color(0x33E78A),
var jumpEndModeColor: JBColor = JBColor.namedColor("jumpEndModeRGB", 0x33E78A),
@OptionTag("targetModeRGB", converter = ColorConverter::class)
var targetModeColor: Color = Color(0xFFB700),
var targetModeColor: JBColor = JBColor.namedColor("targetModeRGB", 0xFFB700),
@OptionTag("definitionModeRGB", converter = ColorConverter::class)
var definitionModeColor: Color = Color(0x6FC5FF),
var definitionModeColor: JBColor = JBColor.namedColor("definitionModeRGB", 0x6FC5FF),
@OptionTag("textHighlightRGB", converter = ColorConverter::class)
var textHighlightColor: Color = Color(0x394B58),
var textHighlightColor: JBColor = JBColor.namedColor("textHighlightRGB", 0x394B58),
@OptionTag("tagForegroundRGB", converter = ColorConverter::class)
var tagForegroundColor: Color = Color(0xFFFFFF),
var tagForegroundColor: JBColor = JBColor.namedColor("tagForegroundRGB", 0xFFFFFF),
@OptionTag("tagBackgroundRGB", converter = ColorConverter::class)
var tagBackgroundColor: Color = Color(0x008299),
var tagBackgroundColor: JBColor = JBColor.namedColor("tagBackgroundRGB", 0x008299),
var searchWholeFile: Boolean = true,
var mapToASCII : Boolean = false,
var mapToASCII: Boolean = false,
var showSearchNotification : Boolean = false
var showSearchNotification: Boolean = false
)
internal class ColorConverter: Converter<Color>() {
override fun toString(value: Color) = value.rgb.toString()
override fun fromString(value: String) = value.toIntOrNull()?.let(::Color)
}

View File

@ -32,7 +32,7 @@ internal class TextHighlighter {
/**
* Label for the search notification.
*/
private class NotificationLabel constructor(text: String?): JLabel(text) {
private class NotificationLabel(text: String?): JLabel(text) {
init {
background = HintUtil.getInformationColor()
foreground = JBColor.foreground()
@ -117,7 +117,7 @@ internal class TextHighlighter {
add(label2, BorderLayout.CENTER)
add(label3, BorderLayout.EAST)
border = BorderFactory.createLineBorder(
if (jumpMode == JumpMode.DISABLED) Color.BLACK else jumpMode.caretColor
if (jumpMode == JumpMode.DISABLED) JBColor.BLACK else jumpMode.caretColor
)
preferredSize = Dimension(