Search in sources :

Example 21 with RenameProcessor

use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.

the class SrcRepositoryUseTest method renamePackage.

private void renamePackage(String packageName, String newPackageName) throws Exception {
    PsiPackage aPackage = JavaPsiFacade.getInstance(myPsiManager.getProject()).findPackage(packageName);
    assertNotNull("Package " + packageName + " not found", aPackage);
    //PsiDirectory dir = aPackage.getDirectories()[0];
    //to rename dir with classes move is used
    new RenameProcessor(myProject, aPackage, newPackageName, true, true).run();
    FileDocumentManager.getInstance().saveAllDocuments();
}
Also used : RenameProcessor(com.intellij.refactoring.rename.RenameProcessor)

Example 22 with RenameProcessor

use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method testRenameClass.

public void testRenameClass() throws Exception {
    configureByFile(BASE_PATH + "AClass.java");
    Document document = getDocument(getFile());
    Collection<HighlightInfo> infos = highlightErrors();
    assertEquals(0, infos.size());
    final PsiClass psiClass = ((PsiJavaFile) getFile()).getClasses()[0];
    new RenameProcessor(myProject, psiClass, "Class2", false, false).run();
    TextRange dirty = myDaemonCodeAnalyzer.getFileStatusMap().getFileDirtyScope(document, Pass.UPDATE_ALL);
    assertEquals(getFile().getTextRange(), dirty);
    highlightErrors();
    assertTrue(myDaemonCodeAnalyzer.isErrorAnalyzingFinished(getFile()));
}
Also used : RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) TextRange(com.intellij.openapi.util.TextRange) ProperTextRange(com.intellij.openapi.util.ProperTextRange)

Example 23 with RenameProcessor

use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.

the class RefactoringFieldTest method performRename.

protected void performRename(String newName) {
    PsiElement element = TargetElementUtil.findTargetElement(myFixture.getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
    new RenameProcessor(getProject(), element, newName, false, false).run();
}
Also used : RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) PsiElement(com.intellij.psi.PsiElement)

Example 24 with RenameProcessor

use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.

the class AbstractJavaFXRenameTest method doRenameWithAutomaticRenamers.

protected void doRenameWithAutomaticRenamers(PsiElement elementAtCaret, String newName) {
    final RenameProcessor processor = new RenameProcessor(getProject(), elementAtCaret, newName, false, false);
    for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
        processor.addRenamerFactory(factory);
    }
    processor.run();
}
Also used : AutomaticRenamerFactory(com.intellij.refactoring.rename.naming.AutomaticRenamerFactory) RenameProcessor(com.intellij.refactoring.rename.RenameProcessor)

Example 25 with RenameProcessor

use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.

the class JavaFXRenameTest method testIdWithRefs.

public void testIdWithRefs() throws Exception {
    myFixture.configureByFiles(getTestName(true) + ".fxml");
    PsiElement element = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
    assertNotNull(element);
    new RenameProcessor(getProject(), element, "lb1", true, true).run();
    myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
}
Also used : RenameProcessor(com.intellij.refactoring.rename.RenameProcessor) PsiElement(com.intellij.psi.PsiElement)

Aggregations

RenameProcessor (com.intellij.refactoring.rename.RenameProcessor)32 PsiElement (com.intellij.psi.PsiElement)10 PsiClass (com.intellij.psi.PsiClass)7 AutomaticRenamerFactory (com.intellij.refactoring.rename.naming.AutomaticRenamerFactory)5 PsiMethod (com.intellij.psi.PsiMethod)3 Project (com.intellij.openapi.project.Project)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 JavaPsiFacade (com.intellij.psi.JavaPsiFacade)2 BuildFile (com.google.idea.blaze.base.lang.buildfile.psi.BuildFile)1 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)1 AbstractProjectViewPSIPane (com.intellij.ide.projectView.impl.AbstractProjectViewPSIPane)1 ClassesTreeStructureProvider (com.intellij.ide.projectView.impl.ClassesTreeStructureProvider)1 FlexMxmlNSDescriptor (com.intellij.javascript.flex.mxml.schema.FlexMxmlNSDescriptor)1 ResourceBundleRenamerFactory (com.intellij.lang.properties.refactoring.rename.ResourceBundleRenamerFactory)1 Editor (com.intellij.openapi.editor.Editor)1 Module (com.intellij.openapi.module.Module)1 DialogBuilder (com.intellij.openapi.ui.DialogBuilder)1 ProperTextRange (com.intellij.openapi.util.ProperTextRange)1 TextRange (com.intellij.openapi.util.TextRange)1 PsiField (com.intellij.psi.PsiField)1