use of com.intellij.codeInsight.hint.EditorFragmentComponent 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;
}
Aggregations