From 657cf85b5ae708afdcf53ee7ecb82883562cb1f3 Mon Sep 17 00:00:00 2001 From: "Alexander.Kirsanov" Date: Wed, 8 Apr 2020 18:54:03 +0300 Subject: [PATCH] Cleanup in DefaultLineMarkerRenderer GitOrigin-RevId: 73315f0dc72be61549129925ec0c21f48fa2647b --- .../BraceHighlightingHandler.java | 2 +- .../markup/DefaultLineMarkerRenderer.java | 23 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java index 1ff632d0a1fe..957d68619c36 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceHighlightingHandler.java @@ -449,7 +449,7 @@ public class BraceHighlightingHandler { editor.putUserData(LINE_MARKER_IN_EDITOR_KEY, null); } - public static LineMarkerRenderer createLineMarkerRenderer(boolean matched) { + public static @NotNull LineMarkerRenderer createLineMarkerRenderer(boolean matched) { final TextAttributesKey key = matched ? CodeInsightColors.MATCHED_BRACE_ATTRIBUTES : CodeInsightColors.UNMATCHED_BRACE_ATTRIBUTES; return new DefaultLineMarkerRenderer(key, 1, 0, LineMarkerRendererEx.Position.RIGHT); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/markup/DefaultLineMarkerRenderer.java b/platform/platform-impl/src/com/intellij/openapi/editor/markup/DefaultLineMarkerRenderer.java index 431f488c3044..149f1b7c65cd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/markup/DefaultLineMarkerRenderer.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/markup/DefaultLineMarkerRenderer.java @@ -12,23 +12,19 @@ import java.awt.*; public class DefaultLineMarkerRenderer implements LineMarkerRendererEx { private final TextAttributesKey myAttributesKey; private final int myThickness; - private final int myDeepness; + private final int myDepth; private final Position myPosition; private final Color myColor; - public DefaultLineMarkerRenderer(TextAttributesKey myAttributesKey) { - this(myAttributesKey, 1, 0, Position.RIGHT); - } - - public DefaultLineMarkerRenderer(TextAttributesKey myAttributesKey, int thickness) { + public DefaultLineMarkerRenderer(@NotNull TextAttributesKey myAttributesKey, int thickness) { this(myAttributesKey, thickness, 0, Position.RIGHT); } - public DefaultLineMarkerRenderer(TextAttributesKey attributesKey, int thickness, int deepness, Position position) { + public DefaultLineMarkerRenderer(@NotNull TextAttributesKey attributesKey, int thickness, int depth, Position position) { myAttributesKey = attributesKey; myThickness = thickness; - myDeepness = deepness; + myDepth = depth; myPosition = position; EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); @@ -38,7 +34,8 @@ public class DefaultLineMarkerRenderer implements LineMarkerRendererEx { if (color != null) { myColor = ColorUtil.isDark(scheme.getDefaultBackground()) ? ColorUtil.shift(color, 1.5d) : color.darker(); - } else { + } + else { myColor = null; } } @@ -49,16 +46,16 @@ public class DefaultLineMarkerRenderer implements LineMarkerRendererEx { g.setColor(myColor); g.fillRect(r.x, r.y, myThickness, r.height); - g.fillRect(r.x + myThickness, r.y, myDeepness, myThickness); - g.fillRect(r.x + myThickness, r.y + r.height - myThickness, myDeepness, myThickness); + g.fillRect(r.x + myThickness, r.y, myDepth, myThickness); + g.fillRect(r.x + myThickness, r.y + r.height - myThickness, myDepth, myThickness); } public TextAttributesKey getAttributesKey() { return myAttributesKey; } - public int getDeepness() { - return myDeepness; + public int getDepth() { + return myDepth; } public int getThickness() {