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);
}
}
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);
});
}
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);
}
}
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;
}
};
}
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);
}
}
Aggregations