### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.ui Index: core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java,v retrieving revision 1.61 diff -u -r1.61 CodeFormatterUtil.java --- core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java 24 May 2007 12:21:43 -0000 1.61 +++ core extension/org/eclipse/jdt/internal/corext/util/CodeFormatterUtil.java 25 May 2007 14:01:18 -0000 @@ -233,15 +233,15 @@ return format2(kind, string, 0, string.length(), indentationLevel, lineSeparator, options); } - public static TextEdit reFormat(int kind, String string, int offset, int length, int indentationLevel, String lineSeparator, Map options) { + public static TextEdit reformat(int kind, String string, int offset, int length, int indentationLevel, String lineSeparator, Map options) { if (offset < 0 || length < 0 || offset + length > string.length()) { throw new IllegalArgumentException("offset or length outside of string. offset: " + offset + ", length: " + length + ", string size: " + string.length()); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ } - return ToolFactory.createCodeFormatter(options, ToolFactory.M_FORMAT_HONOR_NEVER_INDENT_COMMENT_OPTIONS).format(kind, string, offset, length, indentationLevel, lineSeparator); + return ToolFactory.createCodeFormatter(options, ToolFactory.M_FORMAT_EXISTING).format(kind, string, offset, length, indentationLevel, lineSeparator); } - public static TextEdit reFormat(int kind, String string, int indentationLevel, String lineSeparator, Map options) { - return reFormat(kind, string, 0, string.length(), indentationLevel, lineSeparator, options); + public static TextEdit reformat(int kind, String string, int indentationLevel, String lineSeparator, Map options) { + return reformat(kind, string, 0, string.length(), indentationLevel, lineSeparator, options); } /** Index: ui/org/eclipse/jdt/internal/ui/fix/CodeFormatFix.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/fix/CodeFormatFix.java,v retrieving revision 1.7 diff -u -r1.7 CodeFormatFix.java --- ui/org/eclipse/jdt/internal/ui/fix/CodeFormatFix.java 24 May 2007 12:21:43 -0000 1.7 +++ ui/org/eclipse/jdt/internal/ui/fix/CodeFormatFix.java 25 May 2007 14:01:18 -0000 @@ -53,7 +53,7 @@ String content= cu.getBuffer().getContents(); Document document= new Document(content); - TextEdit edit= CodeFormatterUtil.reFormat(CodeFormatter.K_COMPILATION_UNIT, content, 0, TextUtilities.getDefaultLineDelimiter(document), fomatterSettings); + TextEdit edit= CodeFormatterUtil.reformat(CodeFormatter.K_COMPILATION_UNIT, content, 0, TextUtilities.getDefaultLineDelimiter(document), fomatterSettings); if (edit == null || !edit.hasChildren()) return null; Index: ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java,v retrieving revision 1.45 diff -u -r1.45 JavaFormattingStrategy.java --- ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java 24 May 2007 12:21:43 -0000 1.45 +++ ui/org/eclipse/jdt/internal/ui/text/java/JavaFormattingStrategy.java 25 May 2007 14:01:18 -0000 @@ -61,7 +61,7 @@ Map partitioners= null; try { - final TextEdit edit= CodeFormatterUtil.reFormat(CodeFormatter.K_COMPILATION_UNIT, document.get(), partition.getOffset(), partition.getLength(), 0, TextUtilities.getDefaultLineDelimiter(document), getPreferences()); + final TextEdit edit= CodeFormatterUtil.reformat(CodeFormatter.K_COMPILATION_UNIT, document.get(), partition.getOffset(), partition.getLength(), 0, TextUtilities.getDefaultLineDelimiter(document), getPreferences()); if (edit != null) { if (edit.getChildrenSize() > 20) partitioners= TextUtilities.removeDocumentPartitioners(document); Index: ui/org/eclipse/jdt/internal/ui/text/comment/CommentFormattingStrategy.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/comment/CommentFormattingStrategy.java,v retrieving revision 1.49 diff -u -r1.49 CommentFormattingStrategy.java --- ui/org/eclipse/jdt/internal/ui/text/comment/CommentFormattingStrategy.java 24 May 2007 12:21:43 -0000 1.49 +++ ui/org/eclipse/jdt/internal/ui/text/comment/CommentFormattingStrategy.java 25 May 2007 14:01:18 -0000 @@ -115,7 +115,7 @@ int partitionOffset= position.getOffset() - sourceOffset; int sourceLength= partitionOffset + position.getLength(); String source= document.get(sourceOffset, sourceLength); - CodeFormatter commentFormatter= ToolFactory.createCodeFormatter(preferences, ToolFactory.M_FORMAT_HONOR_NEVER_INDENT_COMMENT_OPTIONS); + CodeFormatter commentFormatter= ToolFactory.createCodeFormatter(preferences, ToolFactory.M_FORMAT_EXISTING); int indentationLevel= inferIndentationLevel(source.substring(0, partitionOffset), getTabSize(preferences), getIndentSize(preferences)); edit= commentFormatter.format(getKindForPartitionType(position.getType()), source, partitionOffset, position.getLength(), indentationLevel, TextUtilities.getDefaultLineDelimiter(document));