use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class RenameClassTest method performAction.
private void performAction(String qClassName, String newName) throws Exception {
PsiClass aClass = myJavaFacade.findClass(qClassName, GlobalSearchScope.allScope(getProject()));
assertNotNull("Class " + qClassName + " not found", aClass);
new RenameProcessor(myProject, aClass, newName, true, true).run();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class RenameMethodMultiTest method doTest.
private void doTest(final String className, final String methodSignature, final String newName) throws Exception {
doTest((rootDir, rootAfter) -> {
final JavaPsiFacade manager = getJavaFacade();
final PsiClass aClass = manager.findClass(className, GlobalSearchScope.moduleScope(myModule));
assertNotNull(aClass);
final PsiMethod methodBySignature = aClass.findMethodBySignature(manager.getElementFactory().createMethodFromText(methodSignature + "{}", null), false);
assertNotNull(methodBySignature);
final RenameProcessor renameProcessor = new RenameProcessor(myProject, methodBySignature, newName, false, false);
renameProcessor.run();
FileDocumentManager.getInstance().saveAllDocuments();
});
}
use of com.intellij.refactoring.rename.RenameProcessor in project kotlin by JetBrains.
the class SimpleNameReferenceRenameTest method doTest.
private void doTest(String newName) throws Exception {
configureByFile(getTestName(true) + ".kt");
PsiElement element = TargetElementUtilBase.findTargetElement(myEditor, TargetElementUtilBase.ELEMENT_NAME_ACCEPTED | TargetElementUtilBase.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull(element);
new RenameProcessor(getProject(), element, newName, true, true).run();
checkResultByFile(getTestName(true) + ".kt.after");
}
use of com.intellij.refactoring.rename.RenameProcessor in project android by JetBrains.
the class AndroidRenameTest method renameElementWithTextOccurences.
private void renameElementWithTextOccurences(final String newName) throws Throwable {
Editor editor = myFixture.getEditor();
PsiFile file = myFixture.getFile();
Editor completionEditor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, file);
PsiElement element = TargetElementUtil.findTargetElement(completionEditor, TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED | TargetElementUtil.ELEMENT_NAME_ACCEPTED);
assert element != null;
final PsiElement substitution = RenamePsiElementProcessor.forElement(element).substituteElementToRename(element, editor);
new RenameProcessor(myFixture.getProject(), substitution, newName, false, true).run();
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij by bazelbuild.
the class JavaClassRenameTest method testRenameJavaClass.
@Test
public void testRenameJavaClass() {
PsiJavaFile javaFile = (PsiJavaFile) workspace.createPsiFile(new WorkspacePath("com/google/foo/JavaClass.java"), "package com.google.foo;", "public class JavaClass {}");
BuildFile buildFile = createBuildFile(new WorkspacePath("com/google/foo/BUILD"), "java_library(name = \"ref2\", srcs = [\"JavaClass.java\"])");
new RenameProcessor(getProject(), javaFile.getClasses()[0], "NewName", false, false).run();
assertFileContents(buildFile, "java_library(name = \"ref2\", srcs = [\"NewName.java\"])");
}
Aggregations