use of com.intellij.refactoring.introduceParameterObject.IntroduceParameterObjectProcessor in project intellij-community by JetBrains.
the class IntroduceParameterObjectTest method doTest.
private void doTest(final boolean delegate, final boolean createInner, final Function<PsiMethod, ParameterInfoImpl[]> function) throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
assertNotNull("Class Test not found", aClass);
final PsiMethod method = aClass.findMethodsByName("foo", false)[0];
final ParameterInfoImpl[] datas = function.fun(method);
final JavaIntroduceParameterObjectClassDescriptor classDescriptor = new JavaIntroduceParameterObjectClassDescriptor("Param", "", null, false, createInner, null, datas, method, false);
final List<ParameterInfoImpl> parameters = new JavaMethodDescriptor(method).getParameters();
IntroduceParameterObjectProcessor processor = new IntroduceParameterObjectProcessor<>(method, classDescriptor, parameters, delegate);
processor.run();
});
}
use of com.intellij.refactoring.introduceParameterObject.IntroduceParameterObjectProcessor in project intellij-community by JetBrains.
the class IntroduceParameterObjectTest method doTestExistingClass.
private void doTestExistingClass(final String existingClassName, final String existingClassPackage, final boolean generateAccessors, final String newVisibility, final Function<PsiMethod, ParameterInfoImpl[]> function) throws Exception {
doTest((rootDir, rootAfter) -> {
PsiClass aClass = myJavaFacade.findClass("Test", GlobalSearchScope.projectScope(getProject()));
if (aClass == null) {
aClass = myJavaFacade.findClass("p2.Test", GlobalSearchScope.projectScope(getProject()));
}
assertNotNull("Class Test not found", aClass);
final PsiMethod method = aClass.findMethodsByName("foo", false)[0];
final ParameterInfoImpl[] mergedParams = function.fun(method);
final JavaIntroduceParameterObjectClassDescriptor classDescriptor = new JavaIntroduceParameterObjectClassDescriptor(existingClassName, existingClassPackage, null, true, false, newVisibility, mergedParams, method, generateAccessors);
final List<ParameterInfoImpl> parameters = new JavaMethodDescriptor(method).getParameters();
IntroduceParameterObjectProcessor processor = new IntroduceParameterObjectProcessor<>(method, classDescriptor, parameters, false);
processor.run();
LocalFileSystem.getInstance().refresh(false);
FileDocumentManager.getInstance().saveAllDocuments();
});
}
Aggregations