mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inplace rename: also from injected files (roma)
(cherry picked from commit 952956af58127a477ff81f63f0d7c9b6461d4a4e)
This commit is contained in:
+5
-3
@@ -31,6 +31,7 @@ import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.ProjectScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
@@ -221,10 +222,11 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
|
||||
public void run() {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
final TemplateState state = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
final Editor editor = InjectedLanguageUtil.getTopLevelEditor(myEditor);
|
||||
final TemplateState state = TemplateManagerImpl.getTemplateState(editor);
|
||||
assert state != null;
|
||||
final int segmentsCount = state.getSegmentsCount();
|
||||
final Document document = myEditor.getDocument();
|
||||
final Document document = editor.getDocument();
|
||||
for (int i = 0; i < segmentsCount; i++) {
|
||||
final TextRange segmentRange = state.getSegmentRange(i);
|
||||
document.replaceString(segmentRange.getStartOffset(), segmentRange.getEndOffset(), myOldName);
|
||||
@@ -238,7 +240,7 @@ public class MemberInplaceRenamer extends VariableInplaceRenamer {
|
||||
@Override
|
||||
protected void restoreStateBeforeDialogWouldBeShown() {
|
||||
PsiNamedElement variable = getVariable();
|
||||
final TemplateState state = TemplateManagerImpl.getTemplateState(myEditor);
|
||||
final TemplateState state = TemplateManagerImpl.getTemplateState(InjectedLanguageUtil.getTopLevelEditor(myEditor));
|
||||
assert state != null;
|
||||
final String commandName = RefactoringBundle
|
||||
.message("renaming.0.1.to.2", UsageViewUtil.getType(variable), UsageViewUtil.getDescriptiveName(variable), variable.getName());
|
||||
|
||||
Reference in New Issue
Block a user