use of com.intellij.openapi.editor.ex.EditorEx 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);
}
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class DiffLineSeparatorRenderer method paint.
/*
* Gutter
*/
@Override
public void paint(Editor editor, Graphics g, Rectangle r) {
if (!myCondition.get())
return;
int y = r.y;
int lineHeight = myEditor.getLineHeight();
EditorGutterComponentEx gutter = ((EditorEx) editor).getGutterComponentEx();
int annotationsOffset = gutter.getAnnotationsAreaOffset();
int annotationsWidth = gutter.getAnnotationsAreaWidth();
if (annotationsWidth != 0) {
g.setColor(editor.getColorsScheme().getColor(EditorColors.GUTTER_BACKGROUND));
g.fillRect(annotationsOffset, y, annotationsWidth, lineHeight);
}
draw(g, 0, y, lineHeight, myEditor.getColorsScheme());
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class LineStatusMarkerPopup method createEditorComponent.
@Nullable
private EditorFragmentComponent createEditorComponent(@Nullable FileType fileType, @Nullable List<DiffFragment> wordDiff) {
if (myRange.getType() == Range.INSERTED)
return null;
EditorEx uEditor = (EditorEx) EditorFactory.getInstance().createViewer(myTracker.getVcsDocument(), myTracker.getProject());
uEditor.setColorsScheme(myEditor.getColorsScheme());
DiffUtil.setEditorCodeStyle(myTracker.getProject(), uEditor, fileType);
EditorHighlighterFactory highlighterFactory = EditorHighlighterFactory.getInstance();
uEditor.setHighlighter(highlighterFactory.createEditorHighlighter(myTracker.getProject(), getFileName(myTracker.getDocument())));
if (wordDiff != null) {
int vcsStartShift = myTracker.getVcsTextRange(myRange).getStartOffset();
for (DiffFragment fragment : wordDiff) {
int vcsStart = vcsStartShift + fragment.getStartOffset1();
int vcsEnd = vcsStartShift + fragment.getEndOffset1();
TextDiffType type = getDiffType(fragment);
DiffDrawUtil.createInlineHighlighter(uEditor, vcsStart, vcsEnd, type);
}
}
EditorFragmentComponent fragmentComponent = EditorFragmentComponent.createEditorFragmentComponent(myEditor.getContentComponent(), uEditor, myRange.getVcsLine1(), myRange.getVcsLine2(), false, false);
EditorFactory.getInstance().releaseEditor(uEditor);
return fragmentComponent;
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class LineStatusMarkerRenderer method getMarkerArea.
@NotNull
public static Rectangle getMarkerArea(@NotNull Editor editor, @NotNull Rectangle r, int line1, int line2) {
EditorGutterComponentEx gutter = ((EditorEx) editor).getGutterComponentEx();
// leave 1px for brace highlighters
int x = r.x + 1;
int endX = gutter.getWhitespaceSeparatorOffset();
int y = lineToY(editor, line1);
int endY = lineToY(editor, line2);
return new Rectangle(x, y, endX - x, endY - y);
}
use of com.intellij.openapi.editor.ex.EditorEx in project intellij-community by JetBrains.
the class DaemonRespondToChangesTest method typeInAlienEditor.
private static void typeInAlienEditor(Editor alienEditor, char c) {
TypedAction action = EditorActionManager.getInstance().getTypedAction();
DataContext dataContext = ((EditorEx) alienEditor).getDataContext();
action.actionPerformed(alienEditor, c, dataContext);
}
Aggregations