diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java
index 48263de0188a..471409edf3fa 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java
@@ -68,8 +68,8 @@ public class HighlightNamesUtil {
@Nullable
public static HighlightInfo highlightClassName(PsiClass aClass, PsiElement elementToHighlight, final EditorColorsScheme colorsScheme) {
- HighlightInfoType type = getClassNameHighlightType(aClass);
- if (type != null && elementToHighlight != null) {
+ HighlightInfoType type = getClassNameHighlightType(aClass, elementToHighlight);
+ if (elementToHighlight != null) {
TextAttributes attributes = mergeWithScopeAttributes(aClass, type, colorsScheme);
TextRange range = elementToHighlight.getTextRange();
if (elementToHighlight instanceof PsiJavaCodeReferenceElement) {
@@ -154,7 +154,11 @@ public class HighlightNamesUtil {
return null;
}
- private static HighlightInfoType getClassNameHighlightType(PsiClass aClass) {
+ @NotNull
+ private static HighlightInfoType getClassNameHighlightType(@Nullable PsiClass aClass, @Nullable PsiElement element) {
+ if (element instanceof PsiJavaCodeReferenceElement && element.getParent() instanceof PsiAnonymousClass) {
+ return HighlightInfoType.ANONYMOUS_CLASS_NAME;
+ }
if (aClass != null) {
if (aClass.isAnnotationType()) return HighlightInfoType.ANNOTATION_NAME;
if (aClass.isInterface()) return HighlightInfoType.INTERFACE_NAME;
diff --git a/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java b/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java
index 8f014c571684..0b340cddf195 100644
--- a/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java
+++ b/java/java-impl/src/com/intellij/openapi/options/colors/pages/JavaColorSettingsPage.java
@@ -59,6 +59,7 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.javadoc.markup"), SyntaxHighlighterColors.DOC_COMMENT_MARKUP),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.class"), CodeInsightColors.CLASS_NAME_ATTRIBUTES),
+ new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.anonymous.class"), CodeInsightColors.ANONYMOUS_CLASS_NAME_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.type.parameter"), CodeInsightColors.TYPE_PARAMETER_NAME_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.abstract.class"), CodeInsightColors.ABSTRACT_CLASS_NAME_ATTRIBUTES),
new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.interface"), CodeInsightColors.INTERFACE_NAME_ATTRIBUTES),
@@ -104,6 +105,7 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor
ourTags.put("static_method", CodeInsightColors.STATIC_METHOD_ATTRIBUTES);
ourTags.put("param", CodeInsightColors.PARAMETER_ATTRIBUTES);
ourTags.put("class", CodeInsightColors.CLASS_NAME_ATTRIBUTES);
+ ourTags.put("anonymousClass", CodeInsightColors.ANONYMOUS_CLASS_NAME_ATTRIBUTES);
ourTags.put("typeParameter", CodeInsightColors.TYPE_PARAMETER_NAME_ATTRIBUTES);
ourTags.put("abstractClass", CodeInsightColors.ABSTRACT_CLASS_NAME_ATTRIBUTES);
ourTags.put("interface", CodeInsightColors.INTERFACE_NAME_ATTRIBUTES);
@@ -164,7 +166,7 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor
" long time = Date.parse(\"1.2.3\"); // Method is deprecated\n" +
" int reassignedValue = this.staticField; \n" +
" reassignedValue ++; \n" +
- " new SomeClass() {\n" +
+ " new SomeClass() {\n" +
" {\n" +
" int a = localVar;\n" +
" }\n" +
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
index f18f8396ba1f..acb1f2ae8838 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
@@ -149,13 +149,16 @@ public class HighlightInfo implements Segment {
return EditorColorsManager.getInstance().getGlobalScheme();
}
- public static HighlightInfo createHighlightInfo(@NotNull HighlightInfoType type, @NotNull PsiElement element, String description) {
+ public static HighlightInfo createHighlightInfo(@NotNull HighlightInfoType type,
+ @NotNull PsiElement element,
+ @Nullable String description)
+ {
return createHighlightInfo(type, element, description, htmlEscapeToolTip(description));
}
@Nullable
@NonNls
- public static String htmlEscapeToolTip(String description) {
+ public static String htmlEscapeToolTip(@Nullable String description) {
return description == null ? null : "
"+ XmlStringUtil.escapeString(description)+"";
}
@@ -292,6 +295,7 @@ public class HighlightInfo implements Segment {
if (type == HighlightInfoType.INTERFACE_NAME) return false;
if (type == HighlightInfoType.ABSTRACT_CLASS_NAME) return false;
if (type == HighlightInfoType.CLASS_NAME) return false;
+ if (type == HighlightInfoType.ANONYMOUS_CLASS_NAME) return false;
return true;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java
index 438d9fc311b6..92598f6a067d 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java
@@ -76,6 +76,7 @@ public interface HighlightInfoType {
HighlightInfoType CONSTRUCTOR_DECLARATION = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.CONSTRUCTOR_DECLARATION_ATTRIBUTES);
HighlightInfoType STATIC_METHOD = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.STATIC_METHOD_ATTRIBUTES);
HighlightInfoType CLASS_NAME = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.CLASS_NAME_ATTRIBUTES);
+ HighlightInfoType ANONYMOUS_CLASS_NAME = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.ANONYMOUS_CLASS_NAME_ATTRIBUTES);
HighlightInfoType INTERFACE_NAME = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.INTERFACE_NAME_ATTRIBUTES);
HighlightInfoType TYPE_PARAMETER_NAME = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.TYPE_PARAMETER_NAME_ATTRIBUTES);
HighlightInfoType ABSTRACT_CLASS_NAME = new HighlightInfoTypeImpl(SYMBOL_TYPE_SEVERITY, CodeInsightColors.ABSTRACT_CLASS_NAME_ATTRIBUTES);
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java b/platform/platform-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
index b2878437d427..c6ed84fc282e 100644
--- a/platform/platform-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
+++ b/platform/platform-api/src/com/intellij/openapi/editor/colors/CodeInsightColors.java
@@ -39,6 +39,7 @@ public interface CodeInsightColors {
TextAttributesKey STATIC_FIELD_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("STATIC_FIELD_ATTRIBUTES");
TextAttributesKey PARAMETER_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("PARAMETER_ATTRIBUTES");
TextAttributesKey CLASS_NAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("CLASS_NAME_ATTRIBUTES");
+ TextAttributesKey ANONYMOUS_CLASS_NAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("ANONYMOUS_CLASS_NAME_ATTRIBUTES");
TextAttributesKey TYPE_PARAMETER_NAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("TYPE_PARAMETER_NAME_ATTRIBUTES");
TextAttributesKey INTERFACE_NAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("INTERFACE_NAME_ATTRIBUTES");
TextAttributesKey ABSTRACT_CLASS_NAME_ATTRIBUTES = TextAttributesKey.createTextAttributesKey("ABSTRACT_CLASS_NAME_ATTRIBUTES");
diff --git a/platform/platform-resources-en/src/messages/OptionsBundle.properties b/platform/platform-resources-en/src/messages/OptionsBundle.properties
index 80147583cdbd..a0f76f78116b 100644
--- a/platform/platform-resources-en/src/messages/OptionsBundle.properties
+++ b/platform/platform-resources-en/src/messages/OptionsBundle.properties
@@ -66,6 +66,7 @@ options.java.attribute.descriptor.warning=Warning
options.java.attribute.descriptor.deprecated.symbol=Deprecated symbol
options.java.attribute.descriptor.unused.symbol=Unused symbol
options.java.attribute.descriptor.class=Class
+options.java.attribute.descriptor.anonymous.class=Anonymous class
options.java.attribute.descriptor.type.parameter=Type parameter
options.java.attribute.descriptor.abstract.class=Abstract class
options.java.attribute.descriptor.interface=Interface
diff --git a/platform/platform-resources/src/DefaultColorSchemesManager.xml b/platform/platform-resources/src/DefaultColorSchemesManager.xml
index e0f59def330b..5e47aa78f1a9 100644
--- a/platform/platform-resources/src/DefaultColorSchemesManager.xml
+++ b/platform/platform-resources/src/DefaultColorSchemesManager.xml
@@ -418,6 +418,13 @@
+