Search in sources :

Example 1 with EditorGutterComponentEx

use of com.intellij.openapi.editor.ex.EditorGutterComponentEx in project intellij-community by JetBrains.

the class DiffLineMarkerRenderer method paint.

@Override
public void paint(Editor editor, Graphics g, Rectangle range) {
    Color color = myDiffType.getPolygonColor(editor);
    if (color == null) {
        return;
    }
    EditorGutterComponentEx gutter = ((EditorEx) editor).getGutterComponentEx();
    Graphics2D g2 = (Graphics2D) g;
    int x = 0;
    int y = range.y;
    int width = gutter.getWidth();
    int height = range.height;
    if (!myDiffType.isApplied()) {
        if (height > 2) {
            g.setColor(color);
            g.fillRect(x, y, width, height);
            DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y - 1, color);
            DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y + height - 1, color);
        } else {
            // insertion or deletion, when a range is null. matching the text highlighter which is a 2 pixel line
            DiffUtil.drawDoubleShadowedLine(g2, x, x + width, y - 1, color);
        }
    } else {
        DiffUtil.drawBoldDottedFramingLines(g2, x, x + width, y - 1, y + height - 1, color);
    }
}
Also used : EditorGutterComponentEx(com.intellij.openapi.editor.ex.EditorGutterComponentEx) EditorEx(com.intellij.openapi.editor.ex.EditorEx)

Example 2 with EditorGutterComponentEx

use of com.intellij.openapi.editor.ex.EditorGutterComponentEx in project intellij-community by JetBrains.

the class CoverageLineMarkerRenderer method moveToLine.

public void moveToLine(final int lineNumber, final Editor editor) {
    final int firstOffset = editor.getDocument().getLineStartOffset(lineNumber);
    editor.getCaretModel().moveToOffset(firstOffset);
    editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
    editor.getScrollingModel().runActionOnScrollingFinished(() -> {
        Point p = editor.visualPositionToXY(editor.offsetToVisualPosition(firstOffset));
        EditorGutterComponentEx editorComponent = (EditorGutterComponentEx) editor.getGutter();
        JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();
        p = SwingUtilities.convertPoint(editorComponent, THICKNESS, p.y, layeredPane);
        showHint(editor, p, lineNumber);
    });
}
Also used : EditorGutterComponentEx(com.intellij.openapi.editor.ex.EditorGutterComponentEx) LightweightHint(com.intellij.ui.LightweightHint) HintHint(com.intellij.ui.HintHint)

Example 3 with EditorGutterComponentEx

use of com.intellij.openapi.editor.ex.EditorGutterComponentEx in project intellij-community by JetBrains.

the class EditBreakpointActionHandler method editBreakpoint.

public void editBreakpoint(@NotNull Project project, @NotNull Editor editor, @NotNull Object breakpoint, @NotNull GutterIconRenderer breakpointGutterRenderer) {
    if (BreakpointsDialogFactory.getInstance(project).isBreakpointPopupShowing())
        return;
    EditorGutterComponentEx gutterComponent = ((EditorEx) editor).getGutterComponentEx();
    Point point = gutterComponent.getCenterPoint(breakpointGutterRenderer);
    if (point != null) {
        doShowPopup(project, gutterComponent, point, breakpoint);
    }
}
Also used : EditorGutterComponentEx(com.intellij.openapi.editor.ex.EditorGutterComponentEx) EditorEx(com.intellij.openapi.editor.ex.EditorEx)

Example 4 with EditorGutterComponentEx

use of com.intellij.openapi.editor.ex.EditorGutterComponentEx in project intellij-community by JetBrains.

the class DiffDrawUtil method createFoldingGutterLineRenderer.

@NotNull
private static LineMarkerRenderer createFoldingGutterLineRenderer(@NotNull final TextDiffType type, @NotNull final SeparatorPlacement placement, final boolean doubleLine, final boolean resolved) {
    return new LineMarkerRendererEx() {

        @Override
        public void paint(Editor editor, Graphics g, Rectangle r) {
            EditorGutterComponentEx gutter = ((EditorEx) editor).getGutterComponentEx();
            Graphics2D g2 = (Graphics2D) g;
            int x1 = gutter.getWhitespaceSeparatorOffset();
            int x2 = gutter.getWidth();
            int y = r.y;
            if (placement == SeparatorPlacement.BOTTOM)
                y += editor.getLineHeight();
            drawChunkBorderLine(g2, x1, x2, y - 1, type.getColor(editor), doubleLine, resolved);
        }

        @NotNull
        @Override
        public Position getPosition() {
            return Position.CUSTOM;
        }
    };
}
Also used : EditorGutterComponentEx(com.intellij.openapi.editor.ex.EditorGutterComponentEx) EditorEx(com.intellij.openapi.editor.ex.EditorEx) Editor(com.intellij.openapi.editor.Editor) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with EditorGutterComponentEx

use of com.intellij.openapi.editor.ex.EditorGutterComponentEx in project intellij-community by JetBrains.

the class DiffLineMarkerRenderer method paint.

@Override
public void paint(Editor editor, Graphics g, Rectangle range) {
    EditorGutterComponentEx gutter = ((EditorEx) editor).getGutterComponentEx();
    Graphics2D g2 = (Graphics2D) g;
    int x1 = 0;
    int x2 = x1 + gutter.getWidth();
    int y1, y2;
    if (myEmptyRange && myLastLine) {
        y1 = DiffDrawUtil.lineToY(editor, DiffUtil.getLineCount(editor.getDocument()));
        y2 = y1;
    } else {
        int startLine = editor.getDocument().getLineNumber(myHighlighter.getStartOffset());
        int endLine = editor.getDocument().getLineNumber(myHighlighter.getEndOffset()) + 1;
        y1 = DiffDrawUtil.lineToY(editor, startLine);
        y2 = myEmptyRange ? y1 : DiffDrawUtil.lineToY(editor, endLine);
    }
    if (myHideWithoutLineNumbers && !editor.getSettings().isLineNumbersShown()) {
        x1 = gutter.getWhitespaceSeparatorOffset();
    } else {
        int annotationsOffset = gutter.getAnnotationsAreaOffset();
        int annotationsWidth = gutter.getAnnotationsAreaWidth();
        if (annotationsWidth != 0) {
            drawMarker(editor, g2, x1, annotationsOffset, y1, y2, false);
            x1 = annotationsOffset + annotationsWidth;
        }
    }
    if (myIgnoredFoldingOutline) {
        int xOutline = gutter.getWhitespaceSeparatorOffset();
        drawMarker(editor, g2, xOutline, x2, y1, y2, true);
        drawMarker(editor, g2, x1, xOutline, y1, y2, false);
    } else {
        drawMarker(editor, g2, x1, x2, y1, y2, false);
    }
}
Also used : EditorGutterComponentEx(com.intellij.openapi.editor.ex.EditorGutterComponentEx) EditorEx(com.intellij.openapi.editor.ex.EditorEx)

Aggregations

EditorGutterComponentEx (com.intellij.openapi.editor.ex.EditorGutterComponentEx)13 EditorEx (com.intellij.openapi.editor.ex.EditorEx)6 NotNull (org.jetbrains.annotations.NotNull)4 Editor (com.intellij.openapi.editor.Editor)3 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)2 FileHyperlinkInfo (com.intellij.execution.filters.FileHyperlinkInfo)1 HyperlinkInfo (com.intellij.execution.filters.HyperlinkInfo)1 EditorHyperlinkSupport (com.intellij.execution.impl.EditorHyperlinkSupport)1 AllIcons (com.intellij.icons.AllIcons)1 Disposable (com.intellij.openapi.Disposable)1 AnAction (com.intellij.openapi.actionSystem.AnAction)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 Logger (com.intellij.openapi.diagnostic.Logger)1 ColorKey (com.intellij.openapi.editor.colors.ColorKey)1 EditorFontType (com.intellij.openapi.editor.colors.EditorFontType)1 EditorMouseEventArea (com.intellij.openapi.editor.event.EditorMouseEventArea)1 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1