IDEA-114703 Groovy: "Unnecessary qualified reference" quick fix could be renamed

This commit is contained in:
Max Medvedev
2013-10-22 17:43:08 +04:00
parent 26020322fa
commit e62b8de189
2 changed files with 9 additions and 4 deletions
@@ -105,4 +105,5 @@ add.to.resources=Add to resources
add.type.customizer.to.resources=Add type customizer script to resources
target.0.does.not.exist=Target ''{0}'' does not exist
target.annotation.is.unused=@Target is unused
change.lvalue.type=Change variable ''{0}'' type to ''{1}''
change.lvalue.type=Change variable ''{0}'' type to ''{1}''
replace.qualified.name.with.import=Replace qualified name with import
@@ -50,6 +50,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
private static final Logger LOG = Logger.getInstance(UnnecessaryQualifiedReferenceInspection.class);
@NotNull
@Override
protected BaseInspectionVisitor buildVisitor() {
return new BaseInspectionVisitor() {
@@ -84,7 +85,10 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
final PsiElement parent = ref.getParent();
if (parent instanceof GrMethodCall) {
final GrMethodCall copy = (GrMethodCall)parent.copy();
((GrReferenceExpression)copy.getInvokedExpression()).setQualifier(null);
GrReferenceExpression invoked = (GrReferenceExpression)copy.getInvokedExpression();
assert invoked != null;
invoked.setQualifier(null);
copyResolved = ((GrReferenceExpression)copy.getInvokedExpression()).resolve();
}
@@ -116,7 +120,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
}
@Override
protected GroovyFix buildFix(PsiElement location) {
protected GroovyFix buildFix(@NotNull PsiElement location) {
return new GroovyFix() {
@Override
protected void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
@@ -128,7 +132,7 @@ public class UnnecessaryQualifiedReferenceInspection extends BaseInspection {
@NotNull
@Override
public String getName() {
return GroovyInspectionBundle.message("unnecessary.qualified.reference");
return GroovyInspectionBundle.message("replace.qualified.name.with.import");
}
};
}