buffer.append(" extends ");
if (fDeclaringType.isInterface()) buffer.append(" implements "); else buffer.append(" extends ");
	private boolean createStubs(StringBuffer buf, ImportsStructure imports) throws CoreException {		if (fDeclaringType == null)			return true;		ICompilationUnit workingCopy= null;		try {			final IType currentType= fCompilationUnit.getTypes()[0];			String dummyName= currentType.getElementName();			workingCopy= WorkingCopyUtil.getNewWorkingCopy(fCompilationUnit);			StringBuffer buffer= new StringBuffer();			final IPackageFragment dummyPackage= currentType.getPackageFragment();			if (!dummyPackage.isDefaultPackage()) {				buffer.append("package "); //$NON-NLS-1$				buffer.append(dummyPackage.getElementName());				buffer.append(";\n"); //$NON-NLS-1$			}			buffer.append("public class "); //$NON-NLS-1$			buffer.append(dummyName);			buffer.append(" extends "); //$NON-NLS-1$			buffer.append(fDeclaringType.getFullyQualifiedName('.'));			int start= buffer.length();			buffer.append("{\n\n}"); //$NON-NLS-1$			workingCopy.getBuffer().setContents(buffer.toString());			synchronized (workingCopy) {				workingCopy.reconcile(ICompilationUnit.NO_AST, false, null, new NullProgressMonitor());			}			RefactoringASTParser parser= new RefactoringASTParser(AST.JLS3);			CompilationUnit unit= parser.parse(workingCopy, true);			IType dummyType= workingCopy.getType(dummyName);			ITypeBinding binding= null;			final AbstractTypeDeclaration declaration= ASTNodeSearchUtil.getAbstractTypeDeclarationNode(dummyType, unit);			if (declaration != null) {				binding= declaration.resolveBinding();				if (binding != null) {					IMethodBinding[] bindings= StubUtility2.getOverridableMethods(binding, true);					CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings(fDeclaringType.getJavaProject());					String[] keys= null;					boolean annotations= false;					if (!fDeclaringType.isInterface() && !fDeclaringType.isAnnotation()) {						OverrideMethodDialog dialog= new OverrideMethodDialog(JavaPlugin.getActiveWorkbenchShell(), null, dummyType, true);						dialog.setGenerateComment(false);						dialog.setGenerateAnnotation(false);						dialog.setElementPositionEnabled(false);						if (dialog.open() == Window.OK) {							annotations= dialog.getGenerateAnnotation();							Object[] selection= dialog.getResult();							if (selection != null) {								ArrayList result= new ArrayList(selection.length);								for (int index= 0; index < selection.length; index++) {									if (selection[index] instanceof IMethodBinding)										result.add(((IBinding) selection[index]).getKey());								}								keys= (String[]) result.toArray(new String[result.size()]);								settings.createComments= dialog.getGenerateComment();							}						}					} else {						settings.createComments= false;						List list= new ArrayList();						for (int index= 0; index < bindings.length; index++) {							if (Modifier.isAbstract(bindings[index].getModifiers()))								list.add(bindings[index]);						}						keys= (String[]) list.toArray(new String[list.size()]);					}					if (keys == null) {						setReplacementString(""); //$NON-NLS-1$						setReplacementLength(0);						return false;					}					ASTRewrite rewrite= ASTRewrite.create(unit.getAST());					ListRewrite rewriter= rewrite.getListRewrite(declaration, declaration.getBodyDeclarationsProperty());					String key= null;					MethodDeclaration stub= null;					for (int index= 0; index < keys.length; index++) {						key= keys[index];						for (int offset= 0; offset < bindings.length; offset++) {							if (key.equals(bindings[offset].getKey())) {								stub= StubUtility2.createImplementationStub(workingCopy, rewrite, imports, unit.getAST(), bindings[offset], binding.getName(), settings, annotations);								if (stub != null)									rewriter.insertFirst(stub, null);								break;							}						}					}					IDocument document= new Document(workingCopy.getBuffer().getContents());					try {						rewrite.rewriteAST(document, fCompilationUnit.getJavaProject().getOptions(true)).apply(document, TextEdit.UPDATE_REGIONS);						buf.append(document.get(start, document.getLength() - start));					} catch (MalformedTreeException exception) {						JavaPlugin.log(exception);					} catch (IllegalArgumentException exception) {						JavaPlugin.log(exception);					} catch (BadLocationException exception) {						JavaPlugin.log(exception);					}				}			}			return true;		} finally {			if (workingCopy != null)				workingCopy.discardWorkingCopy();		}	}