use of com.intellij.refactoring.rename.RenameProcessor in project smali by JesusFreke.
the class MethodRenameTest method doRename.
private void doRename(String containingClass, String oldMethodName, String newMethodName) throws Exception {
PsiClass testClass = myJavaFacade.findClass(containingClass, GlobalSearchScope.allScope(getProject()));
PsiMethod method = testClass.findMethodsByName(oldMethodName, false)[0];
RenameProcessor processor = new RenameProcessor(getProject(), method, newMethodName, false, false);
processor.run();
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.refactoring.rename.RenameProcessor in project android by JetBrains.
the class AndroidMultiModuleRenameTest method testLibraryPackageRename.
// Check that renaming package in a library module would rename corresponding reference in AndroidManifest.xml
public void testLibraryPackageRename() throws Exception {
final VirtualFile manifestFile = myFixture.copyFileToProject("rename/AndroidManifest_library_before.xml", LIBRARY_PATH + "/src/AndroidManifest.xml");
myFixture.configureFromExistingVirtualFile(manifestFile);
// At least one Java source has to be copied for .findPackage to return non-null instance
myFixture.copyFileToProject("rename/LibraryClass.java", LIBRARY_PATH + "/src/com/works/customization/my/library/LibraryClass.java");
final PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage("com.works.customization.my.library");
assertNotNull(aPackage);
new RenameProcessor(getProject(), aPackage, "com.works.customization.my.library2", true, true).run();
FileDocumentManager.getInstance().saveAllDocuments();
myFixture.checkResultByFile("rename/AndroidManifest_library_after.xml");
}
use of com.intellij.refactoring.rename.RenameProcessor in project android by JetBrains.
the class AndroidRenameTest method doRenameJavaPackage.
private void doRenameJavaPackage(String packageName, String newPackageName) throws Exception {
final PsiPackage aPackage = JavaPsiFacade.getInstance(getProject()).findPackage(packageName);
assertNotNull("Package " + packageName + " not found", aPackage);
new RenameProcessor(getProject(), aPackage, newPackageName, true, true).run();
FileDocumentManager.getInstance().saveAllDocuments();
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-plugins by JetBrains.
the class FlexHighlightingTest method testAfterRename.
@JSTestOptions({ JSTestOption.WithFlexFacet, JSTestOption.WithGumboSdk })
@SuppressWarnings({ "ConstantConditions" })
public void testAfterRename() throws Exception {
configureByFile(getBasePath() + "/afterRename.xml");
XmlNSDescriptor nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
assertTrue(nsDescriptor.toString(), nsDescriptor instanceof XmlNSDescriptorImpl);
doDoTest(true, true);
new RenameProcessor(getProject(), getFile(), "afterRename.mxml", false, false).run();
assertEquals("afterRename.mxml", getFile().getName());
assertFalse(myFile.isValid());
myFile = myPsiManager.findFile(getFile().getVirtualFile().getParent().findChild("afterRename.mxml"));
assertTrue(myFile.isValid());
nsDescriptor = ((XmlFile) getFile()).getDocument().getRootTagNSDescriptor();
assertTrue(nsDescriptor.toString(), nsDescriptor instanceof FlexMxmlNSDescriptor);
doDoTest(true, true);
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class ProjectViewUpdatingTest method testUpdateProjectView.
public void testUpdateProjectView() throws Exception {
getProjectTreeStructure().setProviders(new ClassesTreeStructureProvider(myProject), new FormMergerTreeStructureProvider(myProject));
final AbstractProjectViewPSIPane pane = myStructure.createPane();
final JTree tree = pane.getTree();
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " +PsiDirectory: updateProjectView\n" + getRootFiles() + " +External Libraries\n");
final PsiJavaFile classFile = (PsiJavaFile) getContentDirectory().findSubdirectory("src").findSubdirectory("com").findSubdirectory("package1").findFile("Form1.java");
final PsiClass aClass = classFile.getClasses()[0];
final PsiFile containingFile = aClass.getContainingFile();
pane.select(aClass, containingFile.getVirtualFile(), true);
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " Form2.form\n" + " -Form:Form1\n" + " [Form1]\n" + " Form1.form\n" + getRootFiles() + " +External Libraries\n", true);
CommandProcessor.getInstance().executeCommand(myProject, () -> new RenameProcessor(myProject, aClass, "Form1_renamed", false, false).run(), null, null);
PlatformTestUtil.waitForAlarm(600);
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " Form2.form\n" + " -Form:Form1_renamed\n" + " Form1.form\n" + " [Form1_renamed]\n" + getRootFiles() + " +External Libraries\n", true);
TreeUtil.collapseAll(pane.getTree(), -1);
PlatformTestUtil.assertTreeEqual(tree, "-Project\n" + " +PsiDirectory: updateProjectView\n" + getRootFiles() + " +External Libraries\n");
final PsiClass aClass2 = JavaDirectoryService.getInstance().createClass(getContentDirectory().findSubdirectory("src").findSubdirectory("com").findSubdirectory("package1"), "Class6");
PlatformTestUtil.waitForAlarm(600);
final PsiFile containingFile2 = aClass2.getContainingFile();
pane.select(aClass2, containingFile2.getVirtualFile(), true);
PlatformTestUtil.assertTreeEqual(pane.getTree(), "-Project\n" + " -PsiDirectory: updateProjectView\n" + " -PsiDirectory: src\n" + " -PsiDirectory: com\n" + " -PsiDirectory: package1\n" + " Class1\n" + " +Class2.java\n" + " Class4.java\n" + " [Class6]\n" + " Form2.form\n" + " +Form:Form1_renamed\n" + getRootFiles() + " +External Libraries\n", true);
}
Aggregations