use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class JavaFXRenameTest method doTest.
private void doTest(final String newName, boolean inline) throws Exception {
myFixture.configureByFiles(getTestName(true) + ".fxml", getTestName(false) + ".java");
PsiElement element = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull(element);
if (inline) {
CodeInsightTestUtil.doInlineRename(new MemberInplaceRenameHandler(), newName, getEditor(), element);
} else {
new RenameProcessor(getProject(), element, newName, true, true).run();
}
myFixture.checkResultByFile(getTestName(true) + "_after.fxml");
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class JavaFXRenameTest method testNestedControllerIdFromJava.
public void testNestedControllerIdFromJava() throws Exception {
myFixture.configureByFiles(getTestName(false) + ".java", getTestName(false) + "Internal.java", getTestName(true) + ".fxml");
final PsiElement elementAtCaret = myFixture.getElementAtCaret();
new RenameProcessor(getProject(), elementAtCaret, "newName", false, false).run();
myFixture.checkResultByFile(getTestName(true) + ".fxml", getTestName(true) + "_after.fxml", false);
myFixture.checkResultByFile(getTestName(false) + ".java", getTestName(false) + "_after.java", false);
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class RenameLocalTest method doTest.
private void doTest(final String newName) throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull(element);
new RenameProcessor(getProject(), element, newName, true, true).run();
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class RenameMethodMultiTest method doAutomaticRenameMethod.
private void doAutomaticRenameMethod(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 processor = new RenameProcessor(myProject, methodBySignature, newName, false, false);
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
processor.addRenamerFactory(factory);
}
processor.run();
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
FileDocumentManager.getInstance().saveAllDocuments();
});
}
use of com.intellij.refactoring.rename.RenameProcessor in project intellij-community by JetBrains.
the class RenameCollisionsTest method doTest.
private void doTest(final String newName) throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".java");
PsiElement element = TargetElementUtil.findTargetElement(myEditor, TargetElementUtil.ELEMENT_NAME_ACCEPTED | TargetElementUtil.REFERENCED_ELEMENT_ACCEPTED);
assertNotNull(element);
new RenameProcessor(getProject(), element, newName, true, true).run();
checkResultByFile(BASE_PATH + getTestName(false) + ".java.after");
}
Aggregations