diff options
Diffstat (limited to 'java/java-impl/src/com/intellij/codeInsight/daemon')
3 files changed, 8 insertions, 4 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaColorProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaColorProvider.java index dfc7169a2777..f74e4431d451 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaColorProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaColorProvider.java @@ -15,7 +15,6 @@ */ package com.intellij.codeInsight.daemon.impl; -import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.editor.ElementColorProvider; import com.intellij.psi.*; import com.intellij.psi.impl.JavaConstantExpressionEvaluator; @@ -32,7 +31,12 @@ import java.awt.*; public class JavaColorProvider implements ElementColorProvider { @Override public Color getColorFrom(@NotNull PsiElement element) { - if (element instanceof PsiNewExpression && element.getLanguage() == JavaLanguage.INSTANCE) { + return getJavaColorFromExpression(element); + } + + @Nullable + public static Color getJavaColorFromExpression(@Nullable PsiElement element) { + if (element instanceof PsiNewExpression) { final PsiNewExpression expr = (PsiNewExpression)element; final PsiType type = expr.getType(); if (type != null) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java index 487b6f07c707..5027752e47d0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java @@ -44,7 +44,7 @@ public class CreateAnnotationMethodFromUsageFix extends CreateFromUsageBaseFix { if (call == null || !call.isValid()) return false; String name = call.getName(); - if (name == null || !JavaPsiFacade.getInstance(call.getProject()).getNameHelper().isIdentifier(name)) return false; + if (name == null || !PsiNameHelper.getInstance(call.getProject()).isIdentifier(name)) return false; if (getAnnotationValueType(call.getValue()) == null) return false; setText(QuickFixBundle.message("create.method.from.usage.text", name)); return true; diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java index c36c25f4b47b..d1a6031c8bf8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreatePropertyFromUsageFix.java @@ -269,7 +269,7 @@ public class CreatePropertyFromUsageFix extends CreateFromUsageBaseFix implement @Override public void run() { String fieldName = state.getVariableValue(FIELD_VARIABLE).getText(); - if (!JavaPsiFacade.getInstance(project).getNameHelper().isIdentifier(fieldName)) return; + if (!PsiNameHelper.getInstance(project).isIdentifier(fieldName)) return; String fieldType = state.getVariableValue(TYPE_VARIABLE).getText(); PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); |