From 1992afa3e25ea464e1f73a68ed07d73cf48e5b28 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 5 Jun 2013 21:58:47 +0400 Subject: [PATCH] java: deprecated API usages eliminated --- .../debugger/ui/impl/DebuggerTreeRenderer.java | 14 +++++++------- .../ide/highlighter/JavaFileHighlighter.java | 4 ++-- .../ide/highlighter/JavaHighlightingColors.java | 8 ++++++-- .../colors/pages/JavaColorSettingsPage.java | 4 ++-- .../groovy/highlighter/DefaultHighlighter.java | 2 +- .../uiDesigner/componentTree/ComponentTree.java | 6 +++--- .../snapShooter/CreateSnapShotAction.java | 6 +++--- 7 files changed, 24 insertions(+), 20 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java index e515575f727f..857443f456c9 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/DebuggerTreeRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -21,7 +21,7 @@ import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.ui.impl.watch.*; import com.intellij.debugger.ui.tree.ValueDescriptor; import com.intellij.icons.AllIcons; -import com.intellij.openapi.editor.SyntaxHighlighterColors; +import com.intellij.ide.highlighter.JavaHighlightingColors; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.util.text.StringUtil; @@ -193,14 +193,14 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer { valueLabelAttribs = XDebuggerUIConstants.CHANGED_VALUE_ATTRIBUTES; } else { - TextAttributes highlightingAttribs = null; + TextAttributes attributes = null; if (valueDescriptor.isNull()){ - highlightingAttribs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SyntaxHighlighterColors.KEYWORD); + attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(JavaHighlightingColors.KEYWORD); } else if (valueDescriptor.isString()) { - highlightingAttribs = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SyntaxHighlighterColors.STRING); + attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(JavaHighlightingColors.STRING); } - valueLabelAttribs = highlightingAttribs != null? SimpleTextAttributes.fromTextAttributes(highlightingAttribs) : DEFAULT_ATTRIBUTES; + valueLabelAttribs = attributes != null? SimpleTextAttributes.fromTextAttributes(attributes) : DEFAULT_ATTRIBUTES; } final EvaluateException exception = descriptor.getEvaluateException(); @@ -248,7 +248,7 @@ public class DebuggerTreeRenderer extends ColoredTreeCellRenderer { } if (escapeAttribs == null) { // lazy init - final TextAttributes fromHighlighter = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SyntaxHighlighterColors.VALID_STRING_ESCAPE); + TextAttributes fromHighlighter = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(JavaHighlightingColors.VALID_STRING_ESCAPE); if (fromHighlighter != null) { escapeAttribs = SimpleTextAttributes.fromTextAttributes(fromHighlighter); } diff --git a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java index f488bb837b16..fd624b1322d2 100644 --- a/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java +++ b/java/java-impl/src/com/intellij/ide/highlighter/JavaFileHighlighter.java @@ -64,8 +64,8 @@ public class JavaFileHighlighter extends SyntaxHighlighterBase { ourMap1.put(StringEscapesTokenTypes.INVALID_UNICODE_ESCAPE_TOKEN, JavaHighlightingColors.INVALID_STRING_ESCAPE); ourMap1.put(JavaTokenType.CHARACTER_LITERAL, JavaHighlightingColors.STRING); - ourMap1.put(JavaTokenType.LPARENTH, JavaHighlightingColors.PARENTHS); - ourMap1.put(JavaTokenType.RPARENTH, JavaHighlightingColors.PARENTHS); + ourMap1.put(JavaTokenType.LPARENTH, JavaHighlightingColors.PARENTHESES); + ourMap1.put(JavaTokenType.RPARENTH, JavaHighlightingColors.PARENTHESES); ourMap1.put(JavaTokenType.LBRACE, JavaHighlightingColors.BRACES); ourMap1.put(JavaTokenType.RBRACE, JavaHighlightingColors.BRACES); diff --git a/java/java-impl/src/com/intellij/ide/highlighter/JavaHighlightingColors.java b/java/java-impl/src/com/intellij/ide/highlighter/JavaHighlightingColors.java index 9d169ed7c0ad..324c0a1257cd 100644 --- a/java/java-impl/src/com/intellij/ide/highlighter/JavaHighlightingColors.java +++ b/java/java-impl/src/com/intellij/ide/highlighter/JavaHighlightingColors.java @@ -23,7 +23,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey; * * @author Rustam Vishnyakov */ -@SuppressWarnings("deprecation") // Later SyntaxHighlighterColors will be moved here. +@SuppressWarnings("deprecation") public class JavaHighlightingColors { public static final TextAttributesKey LINE_COMMENT = SyntaxHighlighterColors.LINE_COMMENT; public static final TextAttributesKey JAVA_BLOCK_COMMENT = SyntaxHighlighterColors.JAVA_BLOCK_COMMENT; @@ -32,7 +32,7 @@ public class JavaHighlightingColors { public static final TextAttributesKey NUMBER = SyntaxHighlighterColors.NUMBER; public static final TextAttributesKey STRING = SyntaxHighlighterColors.STRING; public static final TextAttributesKey OPERATION_SIGN = SyntaxHighlighterColors.OPERATION_SIGN; - public static final TextAttributesKey PARENTHS = SyntaxHighlighterColors.PARENTHS; + public static final TextAttributesKey PARENTHESES = SyntaxHighlighterColors.PARENTHS; public static final TextAttributesKey BRACKETS = SyntaxHighlighterColors.BRACKETS; public static final TextAttributesKey BRACES = SyntaxHighlighterColors.BRACES; public static final TextAttributesKey COMMA = SyntaxHighlighterColors.COMMA; @@ -42,4 +42,8 @@ public class JavaHighlightingColors { public static final TextAttributesKey DOC_COMMENT_MARKUP = SyntaxHighlighterColors.DOC_COMMENT_MARKUP; public static final TextAttributesKey VALID_STRING_ESCAPE = SyntaxHighlighterColors.VALID_STRING_ESCAPE; public static final TextAttributesKey INVALID_STRING_ESCAPE = SyntaxHighlighterColors.INVALID_STRING_ESCAPE; + + /** @deprecated use {@link #PARENTHESES} (to remove in IDEA 14) */ + @SuppressWarnings("SpellCheckingInspection") + public static final TextAttributesKey PARENTHS = PARENTHESES; } 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 8697b8b37558..5f5eb6757553 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 @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -46,7 +46,7 @@ public class JavaColorSettingsPage implements ColorSettingsPage, InspectionColor new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.invalid.escape.in.string"), JavaHighlightingColors.INVALID_STRING_ESCAPE), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.operator.sign"), JavaHighlightingColors.OPERATION_SIGN), - new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.parentheses"), JavaHighlightingColors.PARENTHS), + new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.parentheses"), JavaHighlightingColors.PARENTHESES), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.braces"), JavaHighlightingColors.BRACES), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.brackets"), JavaHighlightingColors.BRACKETS), new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.comma"), JavaHighlightingColors.COMMA), diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java index 4bde4d6628d8..d2e317ac1b58 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/highlighter/DefaultHighlighter.java @@ -177,7 +177,7 @@ public class DefaultHighlighter { public static final TextAttributesKey BRACKETS = TextAttributesKey.createTextAttributesKey(BRACKETS_ID, JavaHighlightingColors.BRACKETS); - public static final TextAttributesKey PARENTHESES = TextAttributesKey.createTextAttributesKey(PARENTHESES_ID, JavaHighlightingColors.PARENTHS); + public static final TextAttributesKey PARENTHESES = TextAttributesKey.createTextAttributesKey(PARENTHESES_ID, JavaHighlightingColors.PARENTHESES); public static final TextAttributesKey OPERATION_SIGN = TextAttributesKey.createTextAttributesKey(OPERATION_SIGN_ID, JavaHighlightingColors.OPERATION_SIGN); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/componentTree/ComponentTree.java b/plugins/ui-designer/src/com/intellij/uiDesigner/componentTree/ComponentTree.java index 875d3930a914..0889ca174181 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/componentTree/ComponentTree.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/componentTree/ComponentTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -19,13 +19,13 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel; import com.intellij.codeInsight.daemon.impl.SeverityUtil; import com.intellij.icons.AllIcons; import com.intellij.ide.DeleteProvider; +import com.intellij.ide.highlighter.JavaHighlightingColors; import com.intellij.ide.util.EditSourceUtil; import com.intellij.ide.util.treeView.NodeDescriptor; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.editor.SyntaxHighlighterColors; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.colors.TextAttributesKey; @@ -346,7 +346,7 @@ public final class ComponentTree extends Tree implements DataProvider { myHighlightAttributes = new HashMap>(); final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); - final TextAttributes attributes = globalScheme.getAttributes(SyntaxHighlighterColors.STRING); + final TextAttributes attributes = globalScheme.getAttributes(JavaHighlightingColors.STRING); myBindingAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_BOLD, UIUtil.getTreeForeground()); myClassAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, UIUtil.getTreeForeground()); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java index 075cf4c46613..c0a151bae963 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/snapShooter/CreateSnapShotAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -28,6 +28,7 @@ import com.intellij.execution.runners.ProgramRunner; import com.intellij.execution.util.JreVersionDetector; import com.intellij.icons.AllIcons; import com.intellij.ide.IdeView; +import com.intellij.ide.highlighter.JavaHighlightingColors; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.LangDataKeys; @@ -35,7 +36,6 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.editor.SyntaxHighlighterColors; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.markup.TextAttributes; @@ -349,7 +349,7 @@ public class CreateSnapShotAction extends AnAction { myFormNameTextField.setText(suggestFormName()); final EditorColorsScheme globalScheme = EditorColorsManager.getInstance().getGlobalScheme(); - final TextAttributes attributes = globalScheme.getAttributes(SyntaxHighlighterColors.STRING); + final TextAttributes attributes = globalScheme.getAttributes(JavaHighlightingColors.STRING); final SimpleTextAttributes titleAttributes = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, attributes.getForegroundColor());