allow new expressions qualifications to be shortened anyway
[idea/community.git] / java / java-impl / src / com / intellij / psi / impl / source / codeStyle / ReferenceAdjuster.java
index f223dd2262193f922492233e6ab963953aa02cea..5e079580c74aa7f293cddf52a4c700416410adf7 100644 (file)
@@ -222,7 +222,12 @@ public class ReferenceAdjuster {
     final PsiManager manager = refClass.getManager();
     final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
     final PsiResolveHelper helper = facade.getResolveHelper();
-    return manager.areElementsEquivalent(refClass, helper.resolveReferencedClass(referenceText, psiReference)) && helper.resolveReferencedVariable(referenceText, psiReference) == null;
+    if (manager.areElementsEquivalent(refClass, helper.resolveReferencedClass(referenceText, psiReference))) {
+      PsiElement parent = psiReference.getParent();
+      if (parent instanceof PsiJavaCodeReferenceElement && parent.getParent() instanceof PsiNewExpression) return true;
+      return helper.resolveReferencedVariable(referenceText, psiReference) == null;
+    }
+    return false;
   }
 
   @NotNull