mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace -> dialog: accept second call as same element if there was local variable with same name as introduced field (IDEA-153747)
This commit is contained in:
+9
@@ -23,6 +23,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.refactoring.RefactoringActionHandler;
|
||||
import com.intellij.refactoring.introduceParameter.AbstractJavaInplaceIntroducer;
|
||||
import com.intellij.refactoring.ui.TypeSelectorManagerImpl;
|
||||
import com.intellij.refactoring.util.occurrences.OccurrenceManager;
|
||||
@@ -81,6 +82,14 @@ public abstract class AbstractInplaceIntroduceFieldPopup extends AbstractJavaInp
|
||||
return new LocalSearchScope(myParentClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean startsOnTheSameElement(RefactoringActionHandler handler, PsiElement element) {
|
||||
return super.startsOnTheSameElement(handler, element) ||
|
||||
myParentClass != null &&
|
||||
element instanceof PsiLocalVariable &&
|
||||
myParentClass.findFieldByName(((PsiLocalVariable)element).getName(), false) != null;
|
||||
}
|
||||
|
||||
protected PsiElement getAnchorElement() {
|
||||
if (myAnchorIdx != -1 && myOccurrences[myAnchorIdx] != null) {
|
||||
return myOccurrences[myAnchorIdx].getParent();
|
||||
|
||||
Reference in New Issue
Block a user