Revet color chemes API chages. Will be commited via "Remote run commit"
[fedora-idea.git] / platform-impl / src / com / intellij / openapi / editor / colors / impl / DefaultColorsScheme.java
blobb181ef932f9cda349410605e12d93854418c6a75
1 /**
2 * @author Yura Cangea
3 */
4 package com.intellij.openapi.editor.colors.impl;
6 import com.intellij.openapi.editor.colors.ColorKey;
7 import com.intellij.openapi.editor.colors.EditorFontType;
8 import com.intellij.openapi.editor.colors.TextAttributesKey;
9 import com.intellij.openapi.editor.colors.ex.DefaultColorSchemesManager;
10 import com.intellij.openapi.editor.markup.TextAttributes;
11 import com.intellij.openapi.util.InvalidDataException;
12 import org.jdom.Element;
14 import java.awt.*;
16 public class DefaultColorsScheme extends AbstractColorsScheme {
17 private String myName;
19 public DefaultColorsScheme(DefaultColorSchemesManager defaultColorSchemesManager) {
20 super(null, defaultColorSchemesManager);
23 public TextAttributes getAttributes(TextAttributesKey key) {
24 if (key == null) return null;
25 TextAttributes attrs = myAttributesMap.get(key);
26 return attrs != null ? attrs : key.getDefaultAttributes();
29 public Color getColor(ColorKey key) {
30 if (key == null) return null;
31 Color color = myColorsMap.get(key);
32 return color != null ? color : key.getDefaultColor();
35 public void readExternal(Element parentNode) throws InvalidDataException {
36 super.readExternal(parentNode);
37 myName = parentNode.getAttributeValue(NAME_ATTR);
40 public String getName() {
41 return myName;
44 public void setAttributes(TextAttributesKey key, TextAttributes attributes) {
47 public void setColor(ColorKey key, Color color) {
50 public void setFont(EditorFontType key, Font font) {
53 public Object clone() {
54 EditorColorsSchemeImpl newScheme = new EditorColorsSchemeImpl(this, myDefaultColorSchemesManager);
55 copyTo(newScheme);
56 newScheme.setName(DEFAULT_SCHEME_NAME);
57 return newScheme;