context= new ContextSensitiveImportRewriteContext(fASTRoot, insertionPosition);
context= new ContextSensitiveImportRewriteContext(fASTRoot, insertionPosition, importRewrite);
	public final void run(IProgressMonitor monitor) throws CoreException {		if (monitor == null)			monitor= new NullProgressMonitor();		try {			monitor.beginTask("", 2); //$NON-NLS-1$			monitor.setTaskName(CodeGenerationMessages.AddUnimplementedMethodsOperation_description);			fCreatedMethods.clear();			ICompilationUnit cu= (ICompilationUnit) fASTRoot.getJavaElement();						AST ast= fASTRoot.getAST();						ASTRewrite astRewrite= ASTRewrite.create(ast);			NewImportRewrite importRewrite= NewImportRewrite.create(fASTRoot, true);						ITypeBinding currTypeBinding= fType;			ListRewrite memberRewriter= null;						ASTNode node= fASTRoot.findDeclaringNode(currTypeBinding);			if (node instanceof AnonymousClassDeclaration) {				memberRewriter= astRewrite.getListRewrite(node, AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY);			} else if (node instanceof AbstractTypeDeclaration) {				ChildListPropertyDescriptor property= ((AbstractTypeDeclaration) node).getBodyDeclarationsProperty();				memberRewriter= astRewrite.getListRewrite(node, property);			} else {				Assert.isTrue(false);				// not possible, we checked this in the constructor			}						final CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(cu.getJavaProject());			settings.createComments= fDoCreateComments;			ASTNode insertion= getNodeToInsertBefore(memberRewriter);						IMethodBinding[] methodsToImplement= fMethodsToImplement;			if (methodsToImplement == null) {				methodsToImplement= StubUtility2.getUnimplementedMethods(currTypeBinding);			}						ImportRewriteContext context= null;			int insertionPosition= fInsertPos;			if (insertionPosition == -1 && fASTRoot.types().size() > 0) {				AbstractTypeDeclaration firstTypeDecl= (AbstractTypeDeclaration)fASTRoot.types().get(0);				insertionPosition= firstTypeDecl.getStartPosition();				if (insertionPosition != -1) {					 context= new ContextSensitiveImportRewriteContext(fASTRoot, insertionPosition);				}			}			for (int i= 0; i < methodsToImplement.length; i++) {				IMethodBinding curr= methodsToImplement[i];				MethodDeclaration stub= StubUtility2.createImplementationStub(cu, astRewrite, new ImportRewrite(importRewrite), ast, curr, currTypeBinding.getName(), settings, currTypeBinding.isInterface(), context);				if (stub != null) {					fCreatedMethods.add(curr.getKey());					if (insertion != null)						memberRewriter.insertBefore(stub, insertion, null);					else						memberRewriter.insertLast(stub, null);				}			}			MultiTextEdit edit= new MultiTextEdit();						TextEdit importEdits= importRewrite.rewriteImports(new SubProgressMonitor(monitor, 1));			fCreatedImports= importRewrite.getCreatedImports();			if (fImports) {				edit.addChild(importEdits);			}			edit.addChild(astRewrite.rewriteAST());						if (fApply) {				JavaModelUtil.applyEdit(cu, edit, fSave, new SubProgressMonitor(monitor, 1));			}		} finally {			monitor.done();		}	}