mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace introduce: restore initial local variable name
This commit is contained in:
+1
-1
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
class Test {
|
||||
void simpleMethod() {
|
||||
boolean B<caret>B = false;
|
||||
boolean b<caret>b = false;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@
|
||||
class Test {
|
||||
|
||||
void simpleMethod() {
|
||||
boolean <caret>BB = false;
|
||||
boolean <caret>bb = false;
|
||||
}
|
||||
}
|
||||
|
||||
+17
@@ -333,6 +333,23 @@ public abstract class AbstractInplaceIntroducer<V extends PsiNameIdentifierOwner
|
||||
myExprMarker = myEditor.getDocument().createRangeMarker(myExpr.getTextRange());
|
||||
}
|
||||
}
|
||||
if (myLocalMarker != null) {
|
||||
final PsiElement refVariableElement = containingFile.findElementAt(myLocalMarker.getStartOffset());
|
||||
if (refVariableElement != null) {
|
||||
final PsiElement parent = refVariableElement.getParent();
|
||||
if (parent instanceof PsiNamedElement) {
|
||||
((PsiNamedElement)parent).setName(myLocalName);
|
||||
}
|
||||
}
|
||||
|
||||
final V localVariable = getLocalVariable();
|
||||
if (localVariable != null && localVariable.isPhysical()) {
|
||||
final PsiElement nameIdentifier = localVariable.getNameIdentifier();
|
||||
if (nameIdentifier != null) {
|
||||
myLocalMarker = myEditor.getDocument().createRangeMarker(nameIdentifier.getTextRange());
|
||||
}
|
||||
}
|
||||
}
|
||||
final List<RangeMarker> occurrenceMarkers = getOccurrenceMarkers();
|
||||
for (int i = 0, occurrenceMarkersSize = occurrenceMarkers.size(); i < occurrenceMarkersSize; i++) {
|
||||
RangeMarker marker = occurrenceMarkers.get(i);
|
||||
|
||||
Reference in New Issue
Block a user