fType.createMethod(formattedContent, sibling, true, null);
IMethod created= fType.createMethod(formattedContent, sibling, true, null); fCreatedMethods.add(created);
		public void run(IProgressMonitor monitor) throws CoreException {			String message= ActionMessages.getFormattedString("AddDelegateMethodsAction.monitor.message", String.valueOf(fList.size())); //$NON-NLS-1$			monitor.beginTask(message, fList.size());					// the preferences			CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings();			boolean addComments= settings.createComments;						// already existing methods			IMethod[] existingMethods = fType.getMethods();			//the delemiter used			String lineDelim = StubUtility.getLineDelimiterUsed(fType);			// the indent used + 1			int indent = StubUtility.getIndentUsed(fType) + 1;			// perhaps we have to add import statements			final ImportsStructure imports =				new ImportsStructure(					fType.getCompilationUnit(),					settings.importOrder,					settings.importThreshold,					true);			for (int i = 0; i < fList.size(); i++) {				//check for cancel each iteration				if (monitor.isCanceled()) {					if (i > 0) {						addImports(imports);					}					return;				}				ITypeHierarchy typeHierarchy = fType.newSupertypeHierarchy(null);				String content = null;				Methods2Field wrapper = (Methods2Field) fList.get(i);				IMethod curr = wrapper.fMethod;				String fieldName = wrapper.fField.getElementName();				IMethod overwrittenMethod =					JavaModelUtil.findMethodImplementationInHierarchy(						typeHierarchy,						fType,						curr.getElementName(),						curr.getParameterTypes(),						curr.isConstructor());				if (overwrittenMethod == null) {					content = createStub(fieldName, curr, addComments, overwrittenMethod, imports);				} else {					int flags = overwrittenMethod.getFlags();					if (Flags.isFinal(flags) || Flags.isPrivate(flags)) {						// we could ask before overwriting final methods						if (fgOverrideFinalsFlag) {							System.out.println("method final"); //$NON-NLS-1$							System.out.println(overwrittenMethod);						}					}					IMethod declaration =						JavaModelUtil.findMethodDeclarationInHierarchy(							typeHierarchy,							fType,							curr.getElementName(),							curr.getParameterTypes(),							curr.isConstructor());					content = createStub(fieldName, declaration, addComments, overwrittenMethod, imports);				}				IJavaElement sibling = null;				IMethod existing =					JavaModelUtil.findMethod(						curr.getElementName(),						curr.getParameterTypes(),						curr.isConstructor(),						existingMethods);				if (existing != null) {					// we could ask before replacing a method					if (fgReplaceFlag) {						System.out.println("method does already exists"); //$NON-NLS-1$						System.out.println(existing);						sibling = StubUtility.findNextSibling(existing);						existing.delete(false, null);					}				} else if (curr.isConstructor() && existingMethods.length > 0) {					// add constructors at the beginning					sibling = existingMethods[0];				}				String formattedContent = StubUtility.codeFormat(content, indent, lineDelim) + lineDelim;				fType.createMethod(formattedContent, sibling, true, null);				monitor.worked(1);			}			addImports(imports);		}