Bug 93564 Preference setting for @Override annotation
20050503 The story for adding the @Override annotation is currently abit confusing. Only the override dialog offers to add the annotation, all other override actions (quick fix, code assist) don't add it. A code style preference setting should be added to be used by all of them and the override wizatd checkbox removed. Requesting PMC approval for new the preference constant /** * A named preference that controls whether to add a override annotation for newly created methods * <p> * Value is of type <code>Boolean</code>. * </p> * @since 3.1 */ PreferenceConstants.CODEGEN_USE_OVERRIDE_ANNOTATION
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/AnonymousTypeCompletionProposal.java
StringBuffer buf= new StringBuffer("new A("); 
		buf.append(replacementString);
		if (!replacementString.endsWith(")")) { 
			buf.append(')');
		}
		if (!createStubs(buf, impStructure)) {
			return false;
		}
		if (document.getChar(offset) != ')')
			buf.append(';');
		
		String lineDelim= StubUtility.getLineDelimiterFor(document);
		final IJavaProject project= fCompilationUnit.getJavaProject();
		IRegion region= document.getLineInformationOfOffset(getReplacementOffset());
		int indent= Strings.computeIndentUnits(document.get(region.getOffset(), region.getLength()), project);
		String replacement= CodeFormatterUtil.format(CodeFormatter.K_EXPRESSION, buf.toString(), 0, null, lineDelim, fDeclaringType.getJavaProject());
		replacement= Strings.changeIndent(replacement, 0, project, CodeFormatterUtil.createIndentString(indent, project), lineDelim);
		setReplacementString(replacement.substring(replacement.indexOf('(') + 1));
		int pos= offset;
		while (pos < document.getLength() && Character.isWhitespace(document.getChar(pos))) {
			pos++;
		}
		if (pos < document.getLength() && document.getChar(pos) == ')') {
			setReplacementLength(pos - offset + 1);
		}
		return true;
	}
}