diff --git a/source/com/intellij/codeInsight/daemon/impl/HighlightInfo.java b/source/com/intellij/codeInsight/daemon/impl/HighlightInfo.java index e5f779125c62..b2124500dcd9 100644 --- a/source/com/intellij/codeInsight/daemon/impl/HighlightInfo.java +++ b/source/com/intellij/codeInsight/daemon/impl/HighlightInfo.java @@ -153,7 +153,7 @@ public class HighlightInfo { LOG.assertTrue(startOffset <= endOffset); } - public HighlightInfo(final TextAttributesKey textAttributes, + public HighlightInfo(final TextAttributesKey textAttributesKey, final HighlightInfoType type, final int startOffset, final int endOffset, @@ -162,7 +162,7 @@ public class HighlightInfo { final HighlightSeverity severity, final boolean afterEndOfLine, final boolean needsUpdateOnTyping) { - this.forcedTextAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributes); + this.forcedTextAttributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(textAttributesKey); this.type = type; this.startOffset = startOffset; this.endOffset = endOffset; diff --git a/source/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java b/source/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java index 6ecefb3fde4d..fdefb5c274a4 100644 --- a/source/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java +++ b/source/com/intellij/codeInsight/daemon/impl/PostHighlightingPass.java @@ -2,6 +2,7 @@ package com.intellij.codeInsight.daemon.impl; import com.intellij.codeInsight.CodeInsightSettings; import com.intellij.codeInsight.CodeInsightUtil; +import com.intellij.codeInsight.CodeInsightColors; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings; import com.intellij.codeInsight.daemon.HighlightDisplayKey; @@ -14,8 +15,10 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; +import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.ex.EditorMarkupModel; import com.intellij.openapi.editor.markup.ErrorStripeRenderer; +import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; @@ -113,9 +116,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { String dclType = UsageViewUtil.capitalize(UsageViewUtil.getType(unusedDcl)); if (dclType == null || dclType.length() == 0) dclType = "Symbol"; - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, - unusedDcl.getNavigationElement(), dclType + message); - + final HighlightInfo highlightInfo = createUnusedSymbolInfo(unusedDcl.getNavigationElement(), dclType + message); highlights.add(highlightInfo); } @@ -228,8 +229,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { int count = myRefCountHolder.getRefCount(variable); if (count == 0) { String message = MessageFormat.format(LOCAL_VARIABLE_IS_NOT_USED, new Object[]{identifier.getText()}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, - identifier, message); + final HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveUnusedVariableFix(variable)); return highlightInfo; } @@ -237,8 +237,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { count = myRefCountHolder.getReadRefCount(variable); if (count == 0) { String message = MessageFormat.format(LOCAL_VARIABLE_IS_NOT_USED_FOR_READING, new Object[]{identifier.getText()}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, - identifier, message); + final HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveUnusedVariableFix(variable)); return highlightInfo; } @@ -247,13 +246,18 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { count = myRefCountHolder.getWriteRefCount(variable); if (count == 0) { String message = MessageFormat.format(LOCAL_VARIABLE_IS_NOT_ASSIGNED, new Object[]{identifier.getText()}); - return HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, identifier, message); + return createUnusedSymbolInfo(identifier, message); } } return null; } + private static HighlightInfo createUnusedSymbolInfo(final PsiElement element, final String message) { + TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES); + return HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, element.getTextRange(), message, attributes); + } + private HighlightInfo processField(PsiField field) { if (field.hasModifierProperty(PsiModifier.PRIVATE)) { PsiIdentifier identifier = field.getNameIdentifier(); @@ -262,7 +266,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { if (count == 0) { if (isSerialVersionUIDField(field)) return null; String message = MessageFormat.format(PRIVATE_FIELD_IS_NOT_USED, new Object[]{identifier.getText()}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, identifier, message); + final HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveUnusedVariableFix(field)); QuickFixAction.registerQuickFixAction(highlightInfo, new CreateGetterOrSetterAction(true, field)); QuickFixAction.registerQuickFixAction(highlightInfo, new CreateGetterOrSetterAction(false, field)); @@ -273,7 +277,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { if (count == 0) { String message = MessageFormat.format(PRIVATE_FIELD_IS_NOT_USED_FOR_READING, new Object[]{identifier.getText()}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, identifier, message); + final HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new RemoveUnusedVariableFix(field)); QuickFixAction.registerQuickFixAction(highlightInfo, new CreateGetterOrSetterAction(true, field)); return highlightInfo; @@ -284,7 +288,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { if (count == 0) { if (!assignedByUIForm(field)) { String message = MessageFormat.format(PRIVATE_FIELD_IS_NOT_ASSIGNED, new Object[]{identifier.getText()}); - HighlightInfo info = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, identifier, message); + HighlightInfo info = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(info, new CreateGetterOrSetterAction(false, field)); return info; } @@ -333,8 +337,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { if (count == 0) { PsiIdentifier identifier = parameter.getNameIdentifier(); String message = MessageFormat.format(PARAMETER_IS_NOT_USED, new Object[]{identifier.getText()}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, - identifier, message); + final HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); if (method.isConstructor()) { QuickFixAction.registerQuickFixAction(highlightInfo, new CreateFieldFromParameterAction(parameter)); } @@ -347,7 +350,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { if (myRefCountHolder.getRefCount(parameter) == 0) { PsiIdentifier identifier = parameter.getNameIdentifier(); String message = MessageFormat.format(PARAMETER_IS_NOT_USED, new Object[]{identifier.getText()}); - return HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, identifier, message); + return createUnusedSymbolInfo(identifier, message); } } @@ -370,8 +373,8 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { String pattern = method.isConstructor() ? PRIVATE_CONSTRUCTOR_IS_NOT_USED : PRIVATE_METHOD_IS_NOT_USED; String symbolName = HighlightMessageUtil.getSymbolName(method, PsiSubstitutor.EMPTY); String message = MessageFormat.format(pattern, new Object[]{symbolName}); - HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, method.getNameIdentifier(), - message); + final PsiIdentifier identifier = method.getNameIdentifier(); + HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new SafeDeleteFix(method)); return highlightInfo; } @@ -407,8 +410,8 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { private static HighlightInfo formatUnusedSymbolHighlightInfo(PsiClass aClass, String pattern) { String symbolName = aClass.getName(); String message = MessageFormat.format(pattern, new Object[]{symbolName}); - HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.UNUSED_SYMBOL, aClass.getNameIdentifier(), - message); + final PsiIdentifier identifier = aClass.getNameIdentifier(); + HighlightInfo highlightInfo = createUnusedSymbolInfo(identifier, message); QuickFixAction.registerQuickFixAction(highlightInfo, new SafeDeleteFix(aClass)); return highlightInfo; } @@ -430,7 +433,7 @@ public class PostHighlightingPass extends TextEditorHighlightingPass { String qName = ((PsiClass)resolved).getQualifiedName(); if (qName != null) { String name = ((PsiClass)resolved).getName(); - isRedundant = qName.equals(packageName + "." + name); + isRedundant = qName.equals(packageName + '.' + name); } } } diff --git a/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index 68905042383f..5b9a4d759d8d 100644 --- a/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -11,6 +11,7 @@ import com.intellij.aspects.psi.PsiPointcutDef; import com.intellij.aspects.psi.PsiPrimitiveTypePattern; import com.intellij.aspects.psi.gen.PsiRegularMethodPattern; import com.intellij.codeInsight.ExceptionUtil; +import com.intellij.codeInsight.CodeInsightColors; import com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings; import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInsight.daemon.impl.HighlightInfo; @@ -22,6 +23,8 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.editor.markup.TextAttributes; +import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.psi.*; import com.intellij.psi.javadoc.PsiDocComment; import com.intellij.psi.jsp.JspDeclaration; @@ -1783,9 +1786,8 @@ public class HighlightUtil { formatType(qualifierExpression.getType()), HighlightMessageUtil.getSymbolName(resolved, result.getSubstitutor()) }); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.ACCESS_STATIC_VIA_INSTANCE, - expr, - description); + + final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.ACCESS_STATIC_VIA_INSTANCE, expr, description); QuickFixAction.registerQuickFixAction(highlightInfo, new AccessStaticViaInstanceFix(expr, result)); QuickFixAction.registerQuickFixAction(highlightInfo, new SwitchOffToolAction(HighlightDisplayKey.ACCESS_STATIC_VIA_INSTANCE)); return highlightInfo; @@ -2040,7 +2042,8 @@ public class HighlightUtil { String description = MessageFormat.format("''{0}'' is deprecated", new Object[]{ HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY)}); - final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.DEPRECATED, elementToHighlight, description); + TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.DEPRECATED_ATTRIBUTES); + final HighlightInfo highlightInfo = HighlightInfo.createHighlightInfo(HighlightInfoType.DEPRECATED, elementToHighlight.getTextRange(), description,attributes); QuickFixAction.registerQuickFixAction(highlightInfo, new SwitchOffToolAction(HighlightDisplayKey.DEPRECATED_SYMBOL)); return highlightInfo; } diff --git a/source/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java b/source/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java index a97fee05b5ff..650165bf80d5 100644 --- a/source/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java +++ b/source/com/intellij/openapi/editor/colors/impl/AbstractColorsScheme.java @@ -3,7 +3,6 @@ */ package com.intellij.openapi.editor.colors.impl; -import com.intellij.codeInsight.CodeInsightColors; import com.intellij.openapi.editor.colors.ColorKey; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.EditorFontType; @@ -12,24 +11,25 @@ import com.intellij.openapi.editor.colors.ex.DefaultColorSchemesManager; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.InvalidDataException; -import com.intellij.openapi.util.JDOMExternalizable; import com.intellij.openapi.util.WriteExternalException; import com.intellij.util.containers.HashMap; +import gnu.trove.THashMap; import org.jdom.Element; import java.awt.*; import java.util.*; import java.util.List; -public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMExternalizable { - private static final int LATEST_VERSION = 1; - +public abstract class AbstractColorsScheme implements EditorColorsScheme { protected EditorColorsScheme myParentScheme; protected int myEditorFontSize; protected float myLineSpacing; - protected Map myValuesMap = new HashMap(); + private Map myFonts = new THashMap(); + private String myEditorFontName; + private String mySchemeName; + // version influences XML format and triggers migration private int myVersion; @@ -56,14 +56,31 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx public abstract void setColor(ColorKey key, Color color); public abstract Color getColor(ColorKey key); - public abstract String getName(); + public String getName() { + return mySchemeName; + } - public abstract void setFont(EditorFontType key, Font font); + public void setFont(EditorFontType key, Font font) { + myFonts.put(key, font); + } public abstract Object clone(); + public void copyTo(AbstractColorsScheme newScheme) { + newScheme.myEditorFontSize = myEditorFontSize; + newScheme.myLineSpacing = myLineSpacing; + newScheme.setEditorFontName(getEditorFontName()); + for (Iterator> iterator = myFonts.entrySet().iterator(); iterator.hasNext();) { + Map.Entry entry = iterator.next(); + newScheme.setFont(entry.getKey(), entry.getValue()); + } + newScheme.myAttributesMap = new HashMap(myAttributesMap); + newScheme.myColorsMap = new HashMap(myColorsMap); + newScheme.myVersion = myVersion; + } + public void setEditorFontName(String fontName) { - myValuesMap.put(EDITOR_FONT_NAME, fontName); + myEditorFontName = fontName; initFonts(); } @@ -77,16 +94,15 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx } public Font getFont(EditorFontType key) { - return (Font)myValuesMap.get(key); + return myFonts.get(key); } public void setName(String name) { - myValuesMap.put(SCHEME_NAME, name); + mySchemeName = name; } public String getEditorFontName() { - String fontName = (String)myValuesMap.get(EDITOR_FONT_NAME); - return fontName == null ? AbstractColorsScheme.DEFAULT_FONT_NAME : fontName; + return myEditorFontName == null ? AbstractColorsScheme.DEFAULT_FONT_NAME : myEditorFontName; } public int getEditorFontSize() { @@ -106,10 +122,10 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx Font italicFont = new Font(editorFontName, Font.ITALIC, editorFontSize); Font boldItalicFont = new Font(editorFontName, Font.BOLD + Font.ITALIC, editorFontSize); - myValuesMap.put(EditorFontType.PLAIN, plainFont); - myValuesMap.put(EditorFontType.BOLD, boldFont); - myValuesMap.put(EditorFontType.ITALIC, italicFont); - myValuesMap.put(EditorFontType.BOLD_ITALIC, boldItalicFont); + myFonts.put(EditorFontType.PLAIN, plainFont); + myFonts.put(EditorFontType.BOLD, boldFont); + myFonts.put(EditorFontType.ITALIC, italicFont); + myFonts.put(EditorFontType.BOLD_ITALIC, boldItalicFont); } public String toString() { @@ -153,30 +169,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx } } - protected void migrateFromOldVersions() { - if (myVersion == 0) { - myVersion = LATEST_VERSION; - migrateFromVersion0(); - } - } - - private void migrateFromVersion0() { - Map attributesToErrorStripe = new HashMap(); - attributesToErrorStripe.put(CodeInsightColors.ERRORS_ATTRIBUTES, Color.red); - attributesToErrorStripe.put(CodeInsightColors.WRONG_REFERENCES_ATTRIBUTES, Color.red); - attributesToErrorStripe.put(CodeInsightColors.NOT_USED_ELEMENT_ATTRIBUTES, Color.yellow); - attributesToErrorStripe.put(CodeInsightColors.DEPRECATED_ATTRIBUTES, Color.yellow); - attributesToErrorStripe.put(CodeInsightColors.WARNINGS_ATTRIBUTES, Color.yellow); - for (Iterator> iterator = attributesToErrorStripe.entrySet().iterator(); iterator.hasNext();) { - final Map.Entry entry = iterator.next(); - TextAttributesKey key = entry.getKey(); - Color color = entry.getValue(); - - TextAttributes attributes = getAttributes(key); - attributes.setErrorStripeColor(color); - } - } - private void readAttributes(Element childNode) throws InvalidDataException { for (Iterator iterator = childNode.getChildren("option").iterator(); iterator.hasNext();) { Element e = (Element)iterator.next(); @@ -200,7 +192,6 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx try { myColorsMap.put(name, new Color(Integer.parseInt(value, 16))); } catch (NumberFormatException e) { - continue; } } } @@ -220,7 +211,7 @@ public abstract class AbstractColorsScheme implements EditorColorsScheme, JDOMEx public void writeExternal(Element parentNode) throws WriteExternalException { parentNode.setAttribute("name", getName()); - parentNode.setAttribute("version", ""+myVersion); + parentNode.setAttribute("version", Integer.toString(myVersion)); if (myParentScheme != null) { parentNode.setAttribute("parent_scheme", myParentScheme.getName()); diff --git a/source/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java b/source/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java index 2727a704725c..53746aac4bc3 100644 --- a/source/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java +++ b/source/com/intellij/openapi/editor/colors/impl/DefaultColorsScheme.java @@ -4,7 +4,6 @@ package com.intellij.openapi.editor.colors.impl; import com.intellij.openapi.editor.colors.ColorKey; -import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.EditorFontType; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.colors.ex.DefaultColorSchemesManager; @@ -52,10 +51,8 @@ public class DefaultColorsScheme extends AbstractColorsScheme { } public Object clone() { - EditorColorsScheme newScheme = new EditorColorsSchemeImpl(this, myDefaultColorSchemesManager); - newScheme.setEditorFontSize(myEditorFontSize); - newScheme.setLineSpacing(myLineSpacing); - newScheme.setEditorFontName((String)myValuesMap.get(EDITOR_FONT_NAME)); + EditorColorsSchemeImpl newScheme = new EditorColorsSchemeImpl(this, myDefaultColorSchemesManager); + copyTo(newScheme); newScheme.setName("Default"); return newScheme; } diff --git a/source/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java b/source/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java index b63ead28c992..b98f6f8a1e42 100644 --- a/source/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java +++ b/source/com/intellij/openapi/editor/colors/impl/EditorColorsSchemeImpl.java @@ -5,14 +5,11 @@ package com.intellij.openapi.editor.colors.impl; import com.intellij.openapi.editor.colors.ColorKey; import com.intellij.openapi.editor.colors.EditorColorsScheme; -import com.intellij.openapi.editor.colors.EditorFontType; import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.editor.colors.ex.DefaultColorSchemesManager; import com.intellij.openapi.editor.markup.TextAttributes; -import com.intellij.util.containers.HashMap; import java.awt.*; -import java.util.Map; public class EditorColorsSchemeImpl extends AbstractColorsScheme { @@ -31,12 +28,7 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme { myColorsMap.put(key, color); } - public void setFont(EditorFontType key, Font font) { - myValuesMap.put(key, font); - } - public TextAttributes getAttributes(TextAttributesKey key) { - migrateFromOldVersions(); if (myAttributesMap.containsKey(key)) { return myAttributesMap.get(key); } else { @@ -45,7 +37,6 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme { } public Color getColor(ColorKey key) { - migrateFromOldVersions(); if (myColorsMap.containsKey(key)) { return myColorsMap.get(key); } else { @@ -53,22 +44,9 @@ public class EditorColorsSchemeImpl extends AbstractColorsScheme { } } - public String getName() { - return (String)myValuesMap.get(SCHEME_NAME); - } - public Object clone() { EditorColorsSchemeImpl newScheme = new EditorColorsSchemeImpl(myParentScheme, DefaultColorSchemesManager.getInstance()); - newScheme.myEditorFontSize = myEditorFontSize; - newScheme.myLineSpacing = myLineSpacing; - - Map newValuesMap = new HashMap(myValuesMap); - Map newAttributesMap = new HashMap(myAttributesMap); - Map newColorsMap = new HashMap(myColorsMap); - newScheme.myValuesMap = newValuesMap; - newScheme.myAttributesMap = newAttributesMap; - newScheme.myColorsMap = newColorsMap; - + copyTo(newScheme); return newScheme; } }