mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace rename: reject new name for variable rename
(cherry picked from commit d0a36e7ecb46b3e7b59f8ab292426db3b734e449)
This commit is contained in:
+5
@@ -252,6 +252,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
|
||||
CommandProcessor.getInstance().executeCommand(myProject, runnable, commandName, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNewName(String newName, ResolveSnapshotProvider.ResolveSnapshot snapshot) {
|
||||
return newName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiElement getSubstituted() {
|
||||
if (mySubstituted != null && mySubstituted.isValid()) return mySubstituted;
|
||||
|
||||
+6
-3
@@ -331,9 +331,7 @@ public class VariableInplaceRenamer {
|
||||
finish();
|
||||
|
||||
TextResult value = templateState.getVariableValue(PRIMARY_VARIABLE_NAME);
|
||||
if (value != null) {
|
||||
myNewName = value.toString();
|
||||
}
|
||||
myNewName = getNewName(value != null ? value.toString() : null, snapshot);
|
||||
|
||||
if (snapshot != null && performAutomaticRename()) {
|
||||
if (LanguageNamesValidation.INSTANCE.forLanguage(scope1.getLanguage()).isIdentifier(myNewName, myProject)) {
|
||||
@@ -462,6 +460,11 @@ public class VariableInplaceRenamer {
|
||||
protected void restoreStateBeforeDialogWouldBeShown() {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected String getNewName(String newName, ResolveSnapshotProvider.ResolveSnapshot snapshot) {
|
||||
return snapshot != null ? newName : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected StartMarkAction startRename() throws StartMarkAction.AlreadyStartedException {
|
||||
final StartMarkAction[] markAction = new StartMarkAction[1];
|
||||
|
||||
Reference in New Issue
Block a user