use of com.intellij.refactoring.rename.RenamePsiElementProcessor in project intellij-community by JetBrains.
the class MemberInplaceRenamer method appendAdditionalElement.
@Override
protected boolean appendAdditionalElement(Collection<PsiReference> refs, Collection<Pair<PsiElement, TextRange>> stringUsages) {
boolean showChooser = super.appendAdditionalElement(refs, stringUsages);
PsiNamedElement variable = getVariable();
if (variable != null) {
final PsiElement substituted = getSubstituted();
if (substituted != null) {
appendAdditionalElement(stringUsages, variable, substituted);
RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(substituted);
final HashMap<PsiElement, String> allRenames = new HashMap<>();
PsiFile currentFile = PsiDocumentManager.getInstance(myProject).getPsiFile(myEditor.getDocument());
processor.prepareRenaming(substituted, "", allRenames, new LocalSearchScope(currentFile));
for (PsiElement element : allRenames.keySet()) {
appendAdditionalElement(stringUsages, variable, element);
}
}
}
return showChooser;
}
use of com.intellij.refactoring.rename.RenamePsiElementProcessor in project intellij by bazelbuild.
the class RenameRefactoringTest method testRenameSuggestionForBuildFile.
@Test
public void testRenameSuggestionForBuildFile() {
BuildFile buildFile = createBuildFile(new WorkspacePath("java/com/google/BUILD"));
RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(buildFile);
RenameDialog dialog = processor.createRenameDialog(getProject(), buildFile, buildFile, null);
String[] suggestions = dialog.getSuggestedNames();
assertThat(suggestions[0]).isEqualTo("BUILD");
}
use of com.intellij.refactoring.rename.RenamePsiElementProcessor in project intellij by bazelbuild.
the class RenameRefactoringTest method testRenameSuggestionForSkylarkFile.
@Test
public void testRenameSuggestionForSkylarkFile() {
BuildFile buildFile = createBuildFile(new WorkspacePath("java/com/google/tools/build_defs.bzl"));
RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(buildFile);
RenameDialog dialog = processor.createRenameDialog(getProject(), buildFile, buildFile, null);
String[] suggestions = dialog.getSuggestedNames();
assertThat(suggestions[0]).isEqualTo("build_defs.bzl");
}
Aggregations