Groovy: in-place introduce from variable always process all occurrences

This commit is contained in:
Max Medvedev
2014-02-10 09:07:52 +04:00
parent f3a4b5f7ee
commit edfbd5e99f
2 changed files with 5 additions and 3 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -262,7 +262,7 @@ public abstract class GrAbstractInplaceIntroducer<Settings extends GrIntroduceSe
@Override
public boolean isReplaceAllOccurrences() {
return myReplaceChoice != OccurrencesChooser.ReplaceChoice.NO || myContext.getOccurrences().length == 1;
return myReplaceChoice != OccurrencesChooser.ReplaceChoice.NO;
}
protected abstract Settings getSettings();
@@ -185,9 +185,11 @@ public abstract class GrIntroduceHandlerBase<Settings extends GrIntroduceSetting
}
else if (context.getStringPart() != null) {
map.put(OccurrencesChooser.ReplaceChoice.NO, Collections.<Object>singletonList(context.getStringPart()));
return map;
}
else if (context.getVar() != null) {
map.put(OccurrencesChooser.ReplaceChoice.NO, Collections.<Object>singletonList(context.getVar()));
map.put(OccurrencesChooser.ReplaceChoice.ALL, Collections.<Object>singletonList(context.getVar()));
return map;
}
PsiElement[] occurrences = context.getOccurrences();