From fc236f93e5deeb46719f3a6109fd35f5bedc627e Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Thu, 22 Mar 2012 22:31:59 +0400 Subject: [PATCH] Created JetHighlightingColors constant container and moved keyword text attributes key there. --- .../highlighter/JetColorSettingsPage.java | 2 +- .../plugin/highlighter/JetHighlighter.java | 9 ++---- .../highlighter/JetHighlightingColors.java | 30 +++++++++++++++++++ 3 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java index 22ccb3bf900..2210f5ed6de 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java @@ -95,7 +95,7 @@ public class JetColorSettingsPage implements ColorSettingsPage { @Override public AttributesDescriptor[] getAttributeDescriptors() { return new AttributesDescriptor[]{ - new AttributesDescriptor("Keyword", JetHighlighter.JET_KEYWORD) + new AttributesDescriptor(JetHighlightingColors.JET_KEYWORD.getExternalName(), JetHighlightingColors.JET_KEYWORD) }; } diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java index 777618e064b..05841c2dd4d 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlighter.java @@ -41,11 +41,6 @@ public class JetHighlighter extends SyntaxHighlighterBase { private static final Map keys1; private static final Map keys2; - static final TextAttributesKey JET_KEYWORD = TextAttributesKey.createTextAttributesKey( - "JET.KEYWORD", - SyntaxHighlighterColors.KEYWORD.getDefaultAttributes() - ); - public static final TextAttributesKey JET_SOFT_KEYWORD; static { TextAttributes attributes = SyntaxHighlighterColors.KEYWORD.getDefaultAttributes().clone(); @@ -173,9 +168,9 @@ public class JetHighlighter extends SyntaxHighlighterBase { keys2 = new HashMap(); - fillMap(keys1, JetTokens.KEYWORDS, JET_KEYWORD); + fillMap(keys1, JetTokens.KEYWORDS, JetHighlightingColors.JET_KEYWORD); - keys1.put(JetTokens.AS_SAFE, JET_KEYWORD); + keys1.put(JetTokens.AS_SAFE, JetHighlightingColors.JET_KEYWORD); keys1.put(JetTokens.LABEL_IDENTIFIER, JET_LABEL_IDENTIFIER); keys1.put(JetTokens.ATAT, JET_LABEL_IDENTIFIER); keys1.put(JetTokens.FIELD_IDENTIFIER, JET_FIELD_IDENTIFIER); diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java new file mode 100644 index 00000000000..fedefc6639d --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.plugin.highlighter; + +import com.intellij.openapi.editor.SyntaxHighlighterColors; +import com.intellij.openapi.editor.colors.TextAttributesKey; + +public class JetHighlightingColors { + public final static TextAttributesKey JET_KEYWORD = TextAttributesKey.createTextAttributesKey( + "Keyword", + SyntaxHighlighterColors.KEYWORD.getDefaultAttributes() + ); + + private JetHighlightingColors() { + } +}