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

Remove some deprecated API usage

This reverts commit 890df1b02b.
This commit is contained in:
张志豪 2021-03-10 23:03:41 +08:00
parent c8d93fe718
commit 06dc2df770
3 changed files with 16 additions and 3 deletions
src/main/kotlin/com/github/izhangzhihao/rainbow/brackets

View File

@ -3,6 +3,7 @@ package com.github.izhangzhihao.rainbow.brackets.action
import com.github.izhangzhihao.rainbow.brackets.RainbowInfo
import com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings
import com.github.izhangzhihao.rainbow.brackets.util.alphaBlend
import com.github.izhangzhihao.rainbow.brackets.util.create
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
@ -24,7 +25,7 @@ class ScopeHighlightingAction : AbstractScopeHighlightingAction() {
highlightManager.addRangeHighlight(this,
rainbowInfo.startOffset,
rainbowInfo.endOffset,
attributes,
create("ScopeHighlightingAction", attributes),
false, //hideByTextChange
RainbowSettings.instance.pressAnyKeyToRemoveTheHighlightingEffects, //hideByAnyKey
highlighters)

View File

@ -3,6 +3,7 @@ package com.github.izhangzhihao.rainbow.brackets.action
import com.github.izhangzhihao.rainbow.brackets.RainbowInfo
import com.github.izhangzhihao.rainbow.brackets.settings.RainbowSettings
import com.github.izhangzhihao.rainbow.brackets.util.alphaBlend
import com.github.izhangzhihao.rainbow.brackets.util.create
import com.intellij.codeInsight.highlighting.HighlightManager
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.colors.EditorColorsManager
@ -28,7 +29,7 @@ class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction()
highlightManager.addRangeHighlight(this,
0,
startOffset,
attributes,
create("ScopeOutsideHighlightingRestrainAction", attributes),
false, //hideByTextChange
RainbowSettings.instance.pressAnyKeyToRemoveTheHighlightingEffects, //hideByAnyKey
highlighters)
@ -40,7 +41,7 @@ class ScopeOutsideHighlightingRestrainAction : AbstractScopeHighlightingAction()
highlightManager.addRangeHighlight(this,
endOffset,
lastOffset,
attributes,
create("ScopeOutsideHighlightingRestrainAction", attributes),
false, //hideByTextChange
RainbowSettings.instance.pressAnyKeyToRemoveTheHighlightingEffects, //hideByAnyKey
highlighters)

View File

@ -0,0 +1,11 @@
package com.github.izhangzhihao.rainbow.brackets.util
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.editor.markup.TextAttributes
import kotlin.reflect.jvm.isAccessible
fun create(name: String, textAttributes: TextAttributes): TextAttributesKey {
val cons = TextAttributesKey::class.constructors.first { it.parameters.size == 3 }
cons.isAccessible = true
return cons.call(name, textAttributes, null)
}