return new JavaRefactoringDescriptor(ID_INTRODUCE_FACTORY, project, Messages.format(RefactoringCoreMessages.IntroduceFactory_descriptor_description, new String[] { fNewMethodName, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fCtorBinding, JavaElementLabels.ALL_FULLY_QUALIFIED)}), getComment(), arguments, RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);
JavaRefactoringDescriptor descriptor= new JavaRefactoringDescriptor(ID_INTRODUCE_FACTORY, project, Messages.format(RefactoringCoreMessages.IntroduceFactory_descriptor_description, new String[] { fNewMethodName, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fCtorBinding, JavaElementLabels.ALL_FULLY_QUALIFIED)}), getComment(), arguments, RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE); return new RefactoringChangeDescriptor(descriptor);
	public Change createChange(IProgressMonitor pm) throws CoreException {		pm.beginTask(RefactoringCoreMessages.IntroduceFactory_createChanges, fAllCallsTo.length); 		final DynamicValidationStateChange result= new DynamicValidationStateChange(RefactoringCoreMessages.IntroduceFactory_name) {					public final ChangeDescriptor getDescriptor() {				final Map arguments= new HashMap();				arguments.put(JavaRefactoringDescriptor.INPUT, fCUHandle.getHandleIdentifier());				arguments.put(JavaRefactoringDescriptor.NAME, fNewMethodName);				final ITypeBinding binding= fFactoryOwningClass.resolveBinding();				arguments.put(JavaRefactoringDescriptor.ELEMENT + 1, binding.getJavaElement().getHandleIdentifier());				arguments.put(ATTRIBUTE_SELECTION, new Integer(fSelectionStart).toString() + " " + new Integer(fSelectionLength).toString()); //$NON-NLS-1$				arguments.put(ATTRIBUTE_PROTECT, Boolean.valueOf(fProtectConstructor).toString());				String project= null;				IJavaProject javaProject= fCUHandle.getJavaProject();				if (javaProject != null)					project= javaProject.getElementName();				return new JavaRefactoringDescriptor(ID_INTRODUCE_FACTORY, project, Messages.format(RefactoringCoreMessages.IntroduceFactory_descriptor_description, new String[] { fNewMethodName, BindingLabelProvider.getBindingLabel(binding, JavaElementLabels.ALL_FULLY_QUALIFIED), BindingLabelProvider.getBindingLabel(fCtorBinding, JavaElementLabels.ALL_FULLY_QUALIFIED)}), getComment(), arguments, RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE);			}		}; 		try {			boolean hitInFactoryClass= false;			boolean hitInCtorClass= false;			for(int i=0; i < fAllCallsTo.length; i++) {				SearchResultGroup		rg= fAllCallsTo[i];				ICompilationUnit		unitHandle= rg.getCompilationUnit();				CompilationUnitChange	cuChange= new CompilationUnitChange(getName(), unitHandle);				if (addAllChangesFor(rg, unitHandle, cuChange))					result.add(cuChange);				if (unitHandle.equals(fFactoryUnitHandle))					hitInFactoryClass= true;				if (unitHandle.equals(ASTCreator.getCu(fCtorOwningClass)))					hitInCtorClass= true;				pm.worked(1);				if (pm.isCanceled())					throw new OperationCanceledException();			}			if (!hitInFactoryClass) { // Handle factory class if no search hits there				CompilationUnitChange cuChange= new CompilationUnitChange(getName(), fFactoryUnitHandle);				addAllChangesFor(null, fFactoryUnitHandle, cuChange);				result.add(cuChange);			}			if (!hitInCtorClass && !fFactoryUnitHandle.equals(ASTCreator.getCu(fCtorOwningClass))) { // Handle constructor-owning class if no search hits there				CompilationUnitChange cuChange= new CompilationUnitChange(getName(), ASTCreator.getCu(fCtorOwningClass));				addAllChangesFor(null, ASTCreator.getCu(fCtorOwningClass), cuChange);				result.add(cuChange);			}			return result;		} finally {			pm.done();		}	}