mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-114703 Groovy: "Unnecessary qualified reference" quick fix could be renamed
This commit is contained in:
+2
-1
@@ -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
|
||||
+7
-3
@@ -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");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user