From 5ceed4c461a192b1be98cd7cee1487b4d709805b Mon Sep 17 00:00:00 2001 From: "Maxim.Medvedev" Date: Mon, 13 Feb 2012 18:22:52 +0400 Subject: [PATCH] IDEA-80683 Groovy: Extract Closure Parameter: do not add package prefix to created variables --- .../plugins/groovy/refactoring/GroovyRefactoringUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java index b0efa193fe2a..8155cb2b594e 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/GroovyRefactoringUtil.java @@ -43,6 +43,7 @@ import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyFileType; +import org.jetbrains.plugins.groovy.lang.GrReferenceAdjuster; import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes; import org.jetbrains.plugins.groovy.lang.lexer.TokenSets; import org.jetbrains.plugins.groovy.lang.psi.*; @@ -446,7 +447,8 @@ public abstract class GroovyRefactoringUtil { /* if (declareFinal) { com.intellij.psi.util.PsiUtil.setModifierProperty((decl.getMembers()[0]), PsiModifier.FINAL, true); }*/ - ((GrStatementOwner)anchorStatement.getParent()).addStatementBefore(decl, (GrStatement)anchorStatement); + final GrStatement statement = ((GrStatementOwner)anchorStatement.getParent()).addStatementBefore(decl, (GrStatement)anchorStatement); + GrReferenceAdjuster.shortenReferences(statement); return id; } @@ -506,7 +508,7 @@ public abstract class GroovyRefactoringUtil { return false; } } - else if (newName.startsWith("'") || newName.startsWith("\"")) { + else if (StringUtil.startsWithChar(newName, '\'') || StringUtil.startsWithChar(newName, '"')) { if (newName.length() < 2 || !newName.endsWith("'")) { return false; }