use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class SimpleDiffChange method createOperation.
//
// Helpers
//
@NotNull
private MyGutterOperation createOperation(@NotNull Side side) {
int offset = side.getStartOffset(myFragment);
EditorEx editor = myViewer.getEditor(side);
RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(offset, offset, HighlighterLayer.ADDITIONAL_SYNTAX, null, HighlighterTargetArea.LINES_IN_RANGE);
return new MyGutterOperation(side, highlighter);
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class SimpleOnesideDiffViewer method onDispose.
@Override
@CalledInAwt
protected void onDispose() {
for (RangeHighlighter highlighter : myHighlighters) {
highlighter.dispose();
}
myHighlighters.clear();
super.onDispose();
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class UnifiedDiffChange method createOperation.
@NotNull
private MyGutterOperation createOperation(@NotNull Side sourceSide) {
int offset = myEditor.getDocument().getLineStartOffset(myLine1);
RangeHighlighter highlighter = myEditor.getMarkupModel().addRangeHighlighter(offset, offset, HighlighterLayer.ADDITIONAL_SYNTAX, null, HighlighterTargetArea.LINES_IN_RANGE);
return new MyGutterOperation(sourceSide, highlighter);
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class UnifiedEditorRangeHighlighter method apply.
public void apply(@Nullable Project project, @NotNull Document document) {
MarkupModel model = DocumentMarkupModel.forDocument(document, project, true);
for (Element piece : myPieces) {
RangeHighlighterEx delegate = piece.getDelegate();
if (!delegate.isValid())
continue;
RangeHighlighter highlighter = model.addRangeHighlighter(piece.getStart(), piece.getEnd(), delegate.getLayer(), delegate.getTextAttributes(), delegate.getTargetArea());
highlighter.setEditorFilter(delegate.getEditorFilter());
highlighter.setCustomRenderer(delegate.getCustomRenderer());
highlighter.setErrorStripeMarkColor(delegate.getErrorStripeMarkColor());
highlighter.setErrorStripeTooltip(delegate.getErrorStripeTooltip());
highlighter.setGutterIconRenderer(delegate.getGutterIconRenderer());
highlighter.setLineMarkerRenderer(delegate.getLineMarkerRenderer());
highlighter.setLineSeparatorColor(delegate.getLineSeparatorColor());
highlighter.setThinErrorStripeMark(delegate.isThinErrorStripeMark());
highlighter.setLineSeparatorPlacement(delegate.getLineSeparatorPlacement());
highlighter.setLineSeparatorRenderer(delegate.getLineSeparatorRenderer());
}
}
use of com.intellij.openapi.editor.markup.RangeHighlighter in project intellij-community by JetBrains.
the class DocumentMarkupModelTest method testInfoTestAttributes.
public void testInfoTestAttributes() throws Exception {
LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<>();
extension.language = "TEXT";
extension.implementationClass = TestAnnotator.class.getName();
PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, myFixture.getTestRootDisposable());
myFixture.configureByText(PlainTextFileType.INSTANCE, "foo");
EditorColorsScheme scheme = new EditorColorsSchemeImpl(new DefaultColorsScheme()) {
{
initFonts();
}
};
scheme.setAttributes(HighlighterColors.TEXT, new TextAttributes(Color.black, Color.white, null, null, Font.PLAIN));
((EditorEx) myFixture.getEditor()).setColorsScheme(scheme);
myFixture.doHighlighting();
MarkupModel model = DocumentMarkupModel.forDocument(myFixture.getEditor().getDocument(), getProject(), false);
RangeHighlighter[] highlighters = model.getAllHighlighters();
assertThat(highlighters).hasSize(1);
TextAttributes attributes = highlighters[0].getTextAttributes();
assertThat(attributes).isNotNull();
assertThat(attributes.getBackgroundColor()).isNull();
assertThat(attributes.getForegroundColor()).isNull();
}
Aggregations