GitOrigin-RevId: bc9e92f31c5e6620cca16af3ab2ff173822b5e5a
This commit is contained in:
Alexey Kudravtsev
2025-08-22 17:15:14 +00:00
committed by intellij-monorepo-bot
parent d17a385e27
commit d6ac6ef668
3 changed files with 67 additions and 70 deletions
@@ -68,7 +68,7 @@ public abstract class EditorGutterComponentEx extends JComponent implements Edit
public abstract int getFoldingAreaOffset();
public abstract @Nullable Point getCenterPoint(GutterIconRenderer renderer);
public abstract @Nullable Point getCenterPoint(@NotNull GutterIconRenderer renderer);
public abstract void setShowDefaultGutterPopup(boolean show);
@@ -36,7 +36,7 @@ public final class EditorUIUtil {
}
}
public static Icon scaleIcon(Icon icon, EditorImpl editor) {
public static Icon scaleIcon(Icon icon, @NotNull EditorImpl editor) {
float scale = getEditorScaleFactor(editor);
return scale == 1 ? icon : IconUtil.scale(icon, editor.getComponent(), scale);
}
@@ -102,10 +102,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterable;
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
import org.jetbrains.annotations.VisibleForTesting;
import org.jetbrains.annotations.*;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
@@ -327,7 +324,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
.install();
}
Image getDragImage(GutterMark renderer) {
@NotNull Image getDragImage(@NotNull GutterMark renderer) {
return IconUtil.toImage(scaleIcon(renderer.getIcon()));
}
@@ -336,7 +333,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@Override
public Dimension getPreferredSize() {
public @NotNull Dimension getPreferredSize() {
int w = myLayout.getWidth();
Dimension size = new Dimension(w, myEditor.getPreferredHeight());
JBInsets.addTo(size, getInsets());
@@ -488,7 +485,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
});
}
private void debugGutterAreas(Graphics2D g) {
private void debugGutterAreas(@NotNull Graphics2D g) {
if (!debug()) return;
Point p = MouseInfo.getPointerInfo().getLocation();
SwingUtilities.convertPointFromScreen(p, this);
@@ -513,7 +510,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintEditorBackgrounds(Graphics g, int firstVisibleOffset, int lastVisibleOffset) {
private void paintEditorBackgrounds(@NotNull Graphics g, int firstVisibleOffset, int lastVisibleOffset) {
myTextFgColors.clear();
Color defaultBackgroundColor = myEditor.getBackgroundColor();
Color defaultForegroundColor = myEditor.getColorsScheme().getDefaultForeground();
@@ -527,8 +524,8 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void drawEditorBackgroundForRange(Graphics g, int startOffset, int endOffset, TextAttributes attributes,
Color defaultBackgroundColor, Color defaultForegroundColor, int startX) {
private void drawEditorBackgroundForRange(@NotNull Graphics g, int startOffset, int endOffset, TextAttributes attributes,
@NotNull Color defaultBackgroundColor, @NotNull Color defaultForegroundColor, int startX) {
Color bgColor = myEditor.getBackgroundColor(attributes);
if (Comparing.equal(bgColor, defaultBackgroundColor)) return;
@@ -551,7 +548,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void processClose(MouseEvent e) {
private void processClose(@NotNull MouseEvent e) {
IdeEventQueue queue = IdeEventQueue.getInstance();
if (getGutterRenderer(e) != null) return;
@@ -563,7 +560,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintAnnotations(Graphics2D g, int startVisualLine, int endVisualLine) {
private void paintAnnotations(@NotNull Graphics2D g, int startVisualLine, int endVisualLine) {
int x = getAnnotationsAreaOffset();
int w = getAnnotationsAreaWidthEx();
@@ -632,7 +629,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintAnnotationLine(Graphics g, TextAnnotationGutterProvider gutterProvider, int line, int x, int y) {
private void paintAnnotationLine(@NotNull Graphics g, @NotNull TextAnnotationGutterProvider gutterProvider, int line, int x, int y) {
var text = gutterProvider.getLineText(line, myEditor);
if (!StringUtil.isEmpty(text)) {
g.setColor(myEditor.getColorsScheme().getColor(gutterProvider.getColor(line, myEditor)));
@@ -652,7 +649,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private Font getFontForText(String text, EditorFontType style) {
private @NotNull Font getFontForText(@NotNull String text, @Nullable EditorFontType style) {
var font = ExperimentalUI.isNewUI() ? JBFont.regular() : myEditor.getColorsScheme().getFont(style);
return UIUtil.getFontWithFallbackIfNeeded(font, text);
}
@@ -667,7 +664,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintLineMarkers(Graphics2D g, int firstVisibleOffset, int lastVisibleOffset, int firstVisibleLine, int lastVisibleLine) {
private void paintLineMarkers(@NotNull Graphics2D g, int firstVisibleOffset, int lastVisibleOffset, int firstVisibleLine, int lastVisibleLine) {
if (isLineMarkersShown()) {
InternalUICustomization service = InternalUICustomization.getInstance();
Graphics graphics = g.create();
@@ -681,12 +678,12 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintBackground(Graphics g,
Rectangle clip,
private void paintBackground(@NotNull Graphics g,
@NotNull Rectangle clip,
int x,
int width,
Color background,
Color caretRowColor) {
@Nullable Color background,
@Nullable Color caretRowColor) {
g.setColor(background);
g.fillRect(x, clip.y, width, clip.height);
@@ -732,7 +729,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return false;
}
private void paintCaretRowBackground(Graphics g, int x, int width, Color color) {
private void paintCaretRowBackground(@NotNull Graphics g, int x, int width, @Nullable Color color) {
if (color != null) {
int caretLine = myEditor.getCaretModel().getVisualPosition().line;
int[] yRange = myEditor.visualLineToYRange(caretLine);
@@ -741,7 +738,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintLineNumbers(Graphics2D g, int startVisualLine, int endVisualLine) {
private void paintLineNumbers(@NotNull Graphics2D g, int startVisualLine, int endVisualLine) {
if (isLineNumbersShown()) {
int offset = getLineNumberAreaOffset() + myLineNumberAreaWidth;
doPaintLineNumbers(g, startVisualLine, endVisualLine, offset, getPrimaryLineNumberConverter());
@@ -752,7 +749,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintCurrentAccessibleLine(Graphics2D g) {
private void paintCurrentAccessibleLine(@NotNull Graphics2D g) {
if (myAccessibleGutterLine != null) {
myAccessibleGutterLine.paint(g);
}
@@ -763,7 +760,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return EditorGutterColor.getEditorGutterBackgroundColor(myEditor, myPaintBackground);
}
private Font getFontForLineNumbers() {
private @NotNull Font getFontForLineNumbers() {
Font editorFont = myEditor.getColorsScheme().getFont(EditorFontType.PLAIN);
float editorFontSize = editorFont.getSize2D();
float delta = (float)AdvancedSettings.getInt("editor.gutter.linenumber.font.size.delta");
@@ -774,7 +771,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return FontLayoutService.getInstance().stringWidth(getFontMetrics(getFontForLineNumbers()), maxLineNumberText);
}
private void doPaintLineNumbers(Graphics2D g, int startVisualLine, int endVisualLine, int offset,
private void doPaintLineNumbers(@NotNull Graphics2D g, int startVisualLine, int endVisualLine, int offset,
@NotNull LineNumberConverter converter) {
int lastLine = myEditor.logicalToVisualPosition(
new LogicalPosition(endLineNumber(), 0))
@@ -1071,7 +1068,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
myLineToGutterRenderers = null;
}
private Int2ObjectMap<List<GutterMark>> buildGutterRenderersCache() {
private @NotNull Int2ObjectMap<List<GutterMark>> buildGutterRenderersCache() {
myLineToGutterRenderersCacheForLogicalLines = logicalLinesMatchVisualOnes();
Int2ObjectMap<List<GutterMark>> lineToGutterRenderers = new Int2ObjectOpenHashMap<>();
processGutterRangeHighlighters(0, myEditor.getDocument().getTextLength(), highlighter -> {
@@ -1186,7 +1183,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private boolean isMergedWithLineNumbers(GutterMark renderer) {
private boolean isMergedWithLineNumbers(@NotNull GutterMark renderer) {
return isLineNumbersShown() &&
renderer instanceof GutterIconRenderer &&
((GutterIconRenderer)renderer).getAlignment() == GutterIconRenderer.Alignment.LINE_NUMBERS;
@@ -1227,14 +1224,14 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@VisibleForTesting
public Collection<GutterIconWithLocation> getLineGutterMarks() {
public @NotNull Collection<GutterIconWithLocation> getLineGutterMarks() {
List<GutterIconWithLocation> list = new ArrayList<>();
for (Int2ObjectMap.Entry<List<GutterMark>> entry : processGutterRenderers()) {
List<GutterMark> marks = entry.getValue();
int line = entry.getIntKey();
for (GutterMark mark : marks) {
if (mark instanceof GutterIconRenderer) {
Point markLocation = getCenterPoint((GutterIconRenderer)mark);
if (mark instanceof GutterIconRenderer gir) {
Point markLocation = getCenterPoint(gir);
list.add(new GutterIconWithLocation(mark, line, markLocation));
}
}
@@ -1269,11 +1266,11 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return rectangle[0];
}
private boolean isHighlighterVisible(RangeHighlighter highlighter) {
private boolean isHighlighterVisible(@NotNull RangeHighlighter highlighter) {
return !FoldingUtil.isHighlighterFolded(myEditor, highlighter);
}
private void paintGutterRenderers(Graphics2D g,
private void paintGutterRenderers(@NotNull Graphics2D g,
int firstVisibleOffset, int lastVisibleOffset, int firstVisibleLine, int lastVisibleLine) {
Object hint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
@@ -1294,7 +1291,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
ContainerUtil.sort(highlighters, Comparator.comparingInt(RangeHighlighter::getLayer));
for (RangeHighlighter highlighter : highlighters) {
paintLineMarkerRenderer(highlighter, g);
paintLineMarkerRenderer(g, highlighter);
}
}
finally {
@@ -1302,11 +1299,11 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
if (!stickyLinePainting) { // suppress gutter icons on sticky lines panel
paintIcons(firstVisibleLine, lastVisibleLine, g);
paintIcons(g, firstVisibleLine, lastVisibleLine);
}
}
private void paintIcons(int firstVisibleLine, int lastVisibleLine, Graphics2D g) {
private void paintIcons(@NotNull Graphics2D g, int firstVisibleLine, int lastVisibleLine) {
VisualLinesIterator visLinesIterator = new VisualLinesIterator(myEditor, firstVisibleLine);
while (!visLinesIterator.atEnd()) {
int visualLine = visLinesIterator.getVisualLine();
@@ -1314,7 +1311,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
int y = visLinesIterator.getY();
List<GutterMark> renderers = getGutterRenderers(visualLine);
paintIconRow(visualLine, y, renderers, g);
paintIconRow(g, visualLine, y, renderers);
if (myHasInlaysWithGutterIcons) {
Rectangle clip = g.getClipBounds();
@@ -1324,7 +1321,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
int height = inlay.getHeightInPixels();
if (height > 0) {
int newY = curY - height;
paintInlayIcon(inlay, g, newY);
paintInlayIcon(g, inlay, newY);
curY = newY;
}
}
@@ -1333,7 +1330,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
if (curY >= clip.y + clip.height) break;
int height = inlay.getHeightInPixels();
if (height > 0) {
paintInlayIcon(inlay, g, curY);
paintInlayIcon(g, inlay, curY);
curY += height;
}
}
@@ -1343,7 +1340,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintInlayIcon(Inlay<?> inlay, Graphics2D g, int y) {
private void paintInlayIcon(@NotNull Graphics2D g, @NotNull Inlay<?> inlay, int y) {
GutterIconRenderer iconRenderer = inlay.getGutterIconRenderer();
if (shouldBeShown(iconRenderer) && checkDumbAware(iconRenderer)) {
Icon icon = scaleIcon(iconRenderer.getIcon());
@@ -1358,7 +1355,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void paintIconRow(int visualLine, int lineY, List<? extends GutterMark> row, Graphics2D g) {
private void paintIconRow(@NotNull Graphics2D g, int visualLine, int lineY, @NotNull List<? extends GutterMark> row) {
processIconsRowForY(lineY, row, (x, y, renderer) -> {
boolean isLoading = myLastActionableClick != null &&
myLastActionableClick.myProgressVisualLine == visualLine &&
@@ -1381,7 +1378,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
});
}
private void paintLineMarkerRenderer(@NotNull RangeHighlighter highlighter, @NotNull Graphics g) {
private void paintLineMarkerRenderer(@NotNull Graphics g, @NotNull RangeHighlighter highlighter) {
LineMarkerRenderer lineMarkerRenderer = highlighter.getLineMarkerRenderer();
if (lineMarkerRenderer != null) {
Rectangle rectangle = getLineRendererRectangle(highlighter);
@@ -1391,7 +1388,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private boolean isLineMarkerVisible(RangeHighlighter highlighter) {
private boolean isLineMarkerVisible(@NotNull RangeHighlighter highlighter) {
int startOffset = highlighter.getStartOffset();
int endOffset = highlighter.getEndOffset();
FoldRegion startFoldRegion = myEditor.getFoldingModel().getCollapsedRegionAtOffset(startOffset);
@@ -1419,7 +1416,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@Nullable
Rectangle getLineRendererRectangle(RangeHighlighter highlighter) {
Rectangle getLineRendererRectangle(@NotNull RangeHighlighter highlighter) {
if (!isLineMarkerVisible(highlighter)) return null;
int startOffset = highlighter.getStartOffset();
@@ -1525,17 +1522,17 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private int getTextAlignmentShiftForInlayIcon(Icon icon, Inlay<?> inlay) {
private int getTextAlignmentShiftForInlayIcon(@NotNull Icon icon, @NotNull Inlay<?> inlay) {
return Math.min(getTextAlignmentShift(icon), inlay.getHeightInPixels() - icon.getIconHeight());
}
private int getTextAlignmentShift(Icon icon) {
private int getTextAlignmentShift(@NotNull Icon icon) {
int centerRelative = (myEditor.getLineHeight() - icon.getIconHeight()) / 2;
int baselineRelative = myEditor.getAscent() - icon.getIconHeight();
return Math.max(centerRelative, baselineRelative);
}
private Color getOutlineColor(boolean isActive) {
private @NotNull Color getOutlineColor(boolean isActive) {
ColorKey key = isActive ? EditorColors.SELECTED_TEARLINE_COLOR : EditorColors.TEARLINE_COLOR;
Color color = myEditor.getColorsScheme().getColor(key);
return color != null ? color : JBColor.black;
@@ -1589,11 +1586,11 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
if (ExperimentalUI.isNewUI()) {
active = myAlphaContext.isVisible();
}
drawFoldingAnchor(width, clip, g, anchor.visualLine, anchor.type, active);
drawFoldingAnchor(g, width, clip, anchor.visualLine, anchor.type, active);
}
}
private void paintFoldingLines(Graphics2D g, Rectangle clip) {
private void paintFoldingLines(@NotNull Graphics2D g, @NotNull Rectangle clip) {
if (ExperimentalUI.isNewUI()) {
return;
}
@@ -1656,7 +1653,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return myEditor.visualLineToY(line) + myEditor.getAscent() - width;
}
private void drawFoldingAnchor(double width, @NotNull Rectangle clip, @NotNull Graphics2D g, int visualLine,
private void drawFoldingAnchor(@NotNull Graphics2D g, double width, @NotNull Rectangle clip, int visualLine,
@NotNull DisplayedFoldingAnchor.Type type, boolean active) {
double off = width / 4;
double height = width + off;
@@ -1691,7 +1688,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void drawDirectedBox(Graphics2D g,
private void drawDirectedBox(@NotNull Graphics2D g,
double centerX,
double centerY,
double width,
@@ -1731,7 +1728,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
drawLine(g, false, centerX, centerY, width, sw);
}
private void drawLine(Graphics2D g, boolean vertical, double centerX, double centerY, double width, double strokeWidth) {
private void drawLine(@NotNull Graphics2D g, boolean vertical, double centerX, double centerY, double width, double strokeWidth) {
double length = width - getSquareInnerOffset(width) * 2;
Line2D line = LinePainter2D.align(g,
EnumSet.of(LinePainter2D.Align.CENTER_X, LinePainter2D.Align.CENTER_Y),
@@ -1768,7 +1765,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private int getFoldingIconY(int visualLine, Icon icon) {
private int getFoldingIconY(int visualLine, @NotNull Icon icon) {
return (int)(myEditor.visualLineToY(visualLine) + (myEditor.getLineHeight() - icon.getIconHeight()) / 2f + 0.5f);
}
@@ -2013,7 +2010,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return myEditor.getVerticalScrollbarOrientation() != EditorEx.VERTICAL_SCROLLBAR_RIGHT;
}
private @Nullable AffineTransform setMirrorTransformIfNeeded(Graphics2D g, int offset, int width) {
private @Nullable AffineTransform setMirrorTransformIfNeeded(@NotNull Graphics2D g, int offset, int width) {
if (isMirrored()) {
AffineTransform old = g.getTransform();
AffineTransform transform = new AffineTransform(old);
@@ -2052,7 +2049,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@SuppressWarnings("SuspiciousNameCombination")
private Rectangle rectangleByFoldOffset(int foldStart, int anchorWidth, int anchorX) {
private @NotNull Rectangle rectangleByFoldOffset(int foldStart, int anchorWidth, int anchorX) {
if (ExperimentalUI.isNewUI()) {
//in the new ui folding anchor click area has full line height, see IDEA-296393
return new Rectangle(anchorX, myEditor.visualLineToY(foldStart), anchorWidth, myEditor.getLineHeight());
@@ -2103,7 +2100,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void updateFreePainters(MouseEvent e) {
private void updateFreePainters(@NotNull MouseEvent e) {
if (!isLineMarkersShown() ||
!ExperimentalUI.isNewUI() ||
!Registry.is("ide.gutter.update.free.markers.on.hover")) {
@@ -2283,7 +2280,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void fireEventToTextAnnotationListeners(MouseEvent e) {
private void fireEventToTextAnnotationListeners(@NotNull MouseEvent e) {
if (myEditor.getMouseEventArea(e) == EditorMouseEventArea.ANNOTATIONS_AREA) {
Point clickPoint = e.getPoint();
@@ -2305,11 +2302,11 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private int getLineNumAtPoint(Point clickPoint) {
private int getLineNumAtPoint(@NotNull Point clickPoint) {
return EditorUtil.yToLogicalLineNoCustomRenderers(myEditor, clickPoint.y);
}
private @Nullable TextAnnotationGutterProvider getProviderAtPoint(Point clickPoint) {
private @Nullable TextAnnotationGutterProvider getProviderAtPoint(@NotNull Point clickPoint) {
int current = getAnnotationsAreaOffset();
if (clickPoint.x < current) return null;
for (TextAnnotationGutterProviderInfo info : myTextAnnotationGutterProviders) {
@@ -2340,7 +2337,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private boolean isPopupAction(MouseEvent e) {
private boolean isPopupAction(@NotNull MouseEvent e) {
GutterIconRenderer renderer = getGutterRenderer(e);
return renderer != null && renderer.getClickAction() == null && getPopupMenuActions(renderer) != null;
}
@@ -2360,7 +2357,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
}
private void invokeGutterAction(MouseEvent e) {
private void invokeGutterAction(@NotNull MouseEvent e) {
PointInfo info = getPointInfo(e.getPoint());
GutterIconRenderer renderer = info == null ? null : info.renderer;
AnAction clickAction = null;
@@ -2454,7 +2451,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return remover;
}
private @Nullable ActiveGutterRenderer getActiveRendererByMouseEvent(MouseEvent e) {
private @Nullable ActiveGutterRenderer getActiveRendererByMouseEvent(@NotNull MouseEvent e) {
if (findFoldingAnchorAt(e.getX(), e.getY()) != null) {
return null;
}
@@ -2537,7 +2534,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@Override
public @Nullable Point getCenterPoint(GutterIconRenderer renderer) {
public @Nullable Point getCenterPoint(@NotNull GutterIconRenderer renderer) {
if (!areIconsShown()) {
for (Int2ObjectMap.Entry<List<GutterMark>> entry : processGutterRenderers()) {
if (ContainerUtil.find(entry.getValue(), renderer) != null) {
@@ -2632,7 +2629,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
myStartIconAreaWidth = width;
}
private void invokePopup(MouseEvent e) {
private void invokePopup(@NotNull MouseEvent e) {
int logicalLineAtCursor = EditorUtil.yPositionToLogicalLine(myEditor, e);
Point point = e.getPoint();
PointInfo info = e instanceof StickyLineComponent.MyMouseEvent ? null : getPointInfo(point);
@@ -2707,7 +2704,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
private static final String EDITOR_GUTTER_CONTEXT_MENU_KEY = "editor.gutter.context.menu";
private void showGutterContextMenu(@NotNull ActionGroup group, MouseEvent e, String place) {
private void showGutterContextMenu(@NotNull ActionGroup group, @NotNull MouseEvent e, @NotNull String place) {
e.consume();
ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(place, group);
putClientProperty(EDITOR_GUTTER_CONTEXT_MENU_KEY, popupMenu);
@@ -2782,7 +2779,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
updateHover(null);
}
private int convertPointToLineNumber(Point p) {
private int convertPointToLineNumber(@NotNull Point p) {
DocumentEx document = myEditor.getDocument();
int line = EditorUtil.yPositionToLogicalLine(myEditor, p);
if (!DocumentUtil.isValidLine(line, document)) return -1;
@@ -2869,7 +2866,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
return pointInfo;
}
private @Nullable GutterIconRenderer getGutterRenderer(MouseEvent e) {
private @Nullable GutterIconRenderer getGutterRenderer(@NotNull MouseEvent e) {
return getGutterRenderer(e.getPoint());
}
@@ -2898,7 +2895,7 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
}
@Override
public AccessibleContext getAccessibleContext() {
public @NotNull AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJComponent() {
};
@@ -2938,12 +2935,12 @@ final class EditorGutterComponentImpl extends EditorGutterComponentEx
private static final class ClickInfo {
final int myLogicalLineAtCursor;
final Point myIconCenterPosition;
final @NotNull Point myIconCenterPosition;
int myProgressVisualLine;
GutterMark myProgressGutterMark;
Runnable myProgressRemover;
ClickInfo(int logicalLineAtCursor, Point iconCenterPosition) {
ClickInfo(int logicalLineAtCursor, @NotNull Point iconCenterPosition) {
myLogicalLineAtCursor = logicalLineAtCursor;
myIconCenterPosition = iconCenterPosition;
}