use of com.intellij.openapi.editor.colors.impl.DefaultColorsScheme 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.colors.impl.DefaultColorsScheme in project intellij-community by JetBrains.
the class ColorSchemeActions method exportScheme.
@Override
protected void exportScheme(@NotNull EditorColorsScheme scheme, @NotNull String exporterName) {
EditorColorsScheme schemeToExport = scheme;
if (scheme instanceof AbstractColorsScheme) {
EditorColorsScheme parent = ((AbstractColorsScheme) scheme).getParentScheme();
if (!(parent instanceof DefaultColorsScheme)) {
schemeToExport = parent;
}
}
if (schemeToExport.getName().startsWith(SchemeManager.EDITABLE_COPY_PREFIX)) {
schemeToExport = (EditorColorsScheme) schemeToExport.clone();
schemeToExport.setName(SchemeManager.getDisplayName(schemeToExport));
}
super.exportScheme(schemeToExport, exporterName);
}
use of com.intellij.openapi.editor.colors.impl.DefaultColorsScheme in project intellij-community by JetBrains.
the class DefaultColorSchemesManager method loadState.
@Override
public void loadState(Element state) {
List<DefaultColorsScheme> schemes = new ArrayList<>();
for (Element schemeElement : state.getChildren(SCHEME_ELEMENT)) {
boolean isUpdated = false;
Attribute nameAttr = schemeElement.getAttribute(NAME_ATTR);
if (nameAttr != null) {
for (DefaultColorsScheme oldScheme : mySchemes) {
if (StringUtil.equals(nameAttr.getValue(), oldScheme.getName())) {
oldScheme.readExternal(schemeElement);
schemes.add(oldScheme);
isUpdated = true;
}
}
}
if (!isUpdated) {
DefaultColorsScheme newScheme = new DefaultColorsScheme();
newScheme.readExternal(schemeElement);
schemes.add(newScheme);
}
}
schemes.add(EmptyColorScheme.INSTANCE);
mySchemes = schemes;
}
Aggregations