use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class IterationState method getBreakAttributes.
public TextAttributes getBreakAttributes() {
TextAttributes attributes = new TextAttributes();
setAttributes(attributes, true);
return attributes;
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class EditorColorsSchemeImplTest method testSaveNoInheritanceAndDefaults.
public void testSaveNoInheritanceAndDefaults() {
TextAttributes declarationAttrs = EditorColorsManager.getInstance().getScheme(EditorColorsScheme.DEFAULT_SCHEME_NAME).getAttributes(DefaultLanguageHighlighterColors.IDENTIFIER).clone();
Pair<EditorColorsScheme, TextAttributes> result = doTestWriteRead(DefaultLanguageHighlighterColors.FUNCTION_DECLARATION, declarationAttrs);
TextAttributes fallbackAttrs = result.first.getAttributes(DefaultLanguageHighlighterColors.FUNCTION_DECLARATION.getFallbackAttributeKey());
assertThat(result.second).isEqualTo(fallbackAttrs);
}
use of com.intellij.openapi.editor.markup.TextAttributes 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();
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class EditorPaintingTest method testCaretRowWinsOverSyntaxEvenInPresenceOfHighlighter.
public void testCaretRowWinsOverSyntaxEvenInPresenceOfHighlighter() throws Exception {
initText("foo");
setUniformEditorHighlighter(new TextAttributes(null, Color.red, null, null, Font.PLAIN));
addRangeHighlighter(0, 3, 0, null, Color.blue);
checkResult();
}
use of com.intellij.openapi.editor.markup.TextAttributes in project intellij-community by JetBrains.
the class EditorColorsSchemeImplTest method testUpgradeFromVer141.
public void testUpgradeFromVer141() throws Exception {
TextAttributesKey constKey = DefaultLanguageHighlighterColors.CONSTANT;
TextAttributesKey fallbackKey = constKey.getFallbackAttributeKey();
assertNotNull(fallbackKey);
EditorColorsScheme scheme = loadScheme("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<scheme name=\"Test\" version=\"141\" parent_scheme=\"Default\">\n" + "<attributes>" + " <option name=\"TEXT\">\n" + " <value>\n" + " option name=\"FOREGROUND\" value=\"ffaaaa\" />\n" + " </value>\n" + " </option>" + "</attributes>" + "</scheme>\n");
TextAttributes constAttrs = scheme.getAttributes(constKey);
TextAttributes fallbackAttrs = scheme.getAttributes(fallbackKey);
assertNotSame(fallbackAttrs, constAttrs);
assertEquals(Font.BOLD | Font.ITALIC, constAttrs.getFontType());
TextAttributes classAttrs = scheme.getAttributes(DefaultLanguageHighlighterColors.CLASS_NAME);
TextAttributes classFallbackAttrs = scheme.getAttributes(DefaultLanguageHighlighterColors.CLASS_NAME.getFallbackAttributeKey());
assertSame(classFallbackAttrs, classAttrs);
}
Aggregations