public void testInfoTestAttributes() throws Exception { LanguageExtensionPoint<Annotator> extension = new LanguageExtensionPoint<Annotator>(); extension.language="TEXT"; extension.implementationClass = TestAnnotator.class.getName(); PlatformTestUtil.registerExtension(ExtensionPointName.create(LanguageAnnotators.EP_NAME), extension, 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(); assertEquals(1, highlighters.length); TextAttributes attributes = highlighters[0].getTextAttributes(); assertNotNull(attributes); assertNull(attributes.getBackgroundColor()); assertNull(attributes.getForegroundColor()); }
@Nullable public EditorColorsScheme getScheme(String name) { for (DefaultColorsScheme scheme : mySchemes) { if (name.equals(scheme.getName())) return scheme; } return null; }
@Override public void readExternal(Element element) throws InvalidDataException { List schemes = element.getChildren(SCHEME_ELEMENT); for (Object scheme : schemes) { Element schemeElement = (Element)scheme; DefaultColorsScheme newScheme = new DefaultColorsScheme(this); newScheme.readExternal(schemeElement); mySchemes.add(newScheme); } }
public DefaultColorSchemesManager() { mySchemes = new ArrayList<DefaultColorsScheme>(); }
@NotNull public DefaultColorsScheme[] getAllSchemes() { return mySchemes.toArray(new DefaultColorsScheme[mySchemes.size()]); }
@NotNull public DefaultColorsScheme getFirstScheme() { return mySchemes.get(0); }
public DefaultColorsScheme[] getAllSchemes() { return mySchemes.toArray(new DefaultColorsScheme[mySchemes.size()]); }
public boolean isDefault() { return myParentScheme instanceof DefaultColorsScheme; }