diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java index 30a7228d9336..1cfabe0d6cdf 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/GrIntroduceHandlerBase.java @@ -741,19 +741,29 @@ public abstract class GrIntroduceHandlerBase result = ContainerUtil.newArrayList(myLocalVar.getName()); + + GrExpression initializer = myLocalVar.getInitializerGroovy(); + if (initializer != null) { + ContainerUtil.addAll(result, GroovyNameSuggestionUtil.suggestVariableNames(initializer, new GroovyInplaceFieldValidator(getContext()), false)); + } + mySuggestedNames = ArrayUtil.toStringArray(result); + } + else { + mySuggestedNames = GroovyNameSuggestionUtil.suggestVariableNames(context.getExpression(), new GroovyInplaceFieldValidator(getContext()), false); + } + myApplicablePlaces = getApplicableInitPlaces(); + } @Nullable @Override @@ -72,28 +95,6 @@ public class GrInplaceFieldIntroducer extends GrAbstractInplaceIntroducer result = ContainerUtil.newArrayList(var.getName()); - - GrExpression initializer = var.getInitializerGroovy(); - if (initializer != null) { - ContainerUtil.addAll(result, GroovyNameSuggestionUtil.suggestVariableNames(initializer, new GroovyInplaceFieldValidator(getContext()), false)); - } - mySuggestedNames = ArrayUtil.toStringArray(result); - } - else { - mySuggestedNames = GroovyNameSuggestionUtil.suggestVariableNames(context.getExpression(), new GroovyInplaceFieldValidator(getContext()), false); - } - myApplicablePlaces = getApplicableInitPlaces(); - } - @Override protected GrVariable runRefactoring(GrIntroduceContext context, GrIntroduceFieldSettings settings, boolean processUsages) { GrIntroduceFieldProcessor processor = new GrIntroduceFieldProcessor(context, settings); @@ -146,7 +147,7 @@ public class GrInplaceFieldIntroducer extends GrAbstractInplaceIntroducer