Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 159911 Details for
Bug 270209
[format] Condensed block comment formatting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Additional patch
v04.txt (text/plain), 13.77 KB, created by
Frederic Fusier
on 2010-02-23 06:32:04 EST
(
hide
)
Description:
Additional patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2010-02-23 06:32:04 EST
Size:
13.77 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java,v >retrieving revision 1.103 >diff -u -r1.103 DefaultCodeFormatterConstants.java >--- formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 23 Feb 2010 10:56:17 -0000 1.103 >+++ formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 23 Feb 2010 11:30:20 -0000 >@@ -616,32 +616,6 @@ > > /** > * <pre> >- * FORMATTER / Option to control whether block comments are condensed or not >- * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_block_comment" >- * - possible values: { TRUE, FALSE } >- * - default: FALSE >- * </pre> >- * @see #TRUE >- * @see #FALSE >- * @since 3.6 >- */ >- public final static String FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT = "org.eclipse.jdt.core.formatter.comment.condensed_block_comment"; //$NON-NLS-1$ >- >- /** >- * <pre> >- * FORMATTER / Option to control whether javadoc comments are condensed or not >- * - option id: "org.eclipse.jdt.core.formatter.comment.condensed_javadoc_comment" >- * - possible values: { TRUE, FALSE } >- * - default: FALSE >- * </pre> >- * @see #TRUE >- * @see #FALSE >- * @since 3.6 >- */ >- public final static String FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT = "org.eclipse.jdt.core.formatter.comment.condensed_javadoc_comment"; //$NON-NLS-1$ >- >- /** >- * <pre> > * FORMATTER / Option to control whether comments are formatted > * - option id: "org.eclipse.jdt.core.formatter.comment.format_comments" > * - possible values: { TRUE, FALSE } >@@ -798,6 +772,32 @@ > > /** > * <pre> >+ * FORMATTER / Option to control whether block comments will have new lines at boundaries >+ * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" >+ * - possible values: { TRUE, FALSE } >+ * - default: TRUE >+ * </pre> >+ * @see #TRUE >+ * @see #FALSE >+ * @since 3.6 >+ */ >+ public final static String FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES = "org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries"; //$NON-NLS-1$ >+ >+ /** >+ * <pre> >+ * FORMATTER / Option to control whether javadoc comments will have new lines at boundaries >+ * - option id: "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" >+ * - possible values: { TRUE, FALSE } >+ * - default: TRUE >+ * </pre> >+ * @see #TRUE >+ * @see #FALSE >+ * @since 3.6 >+ */ >+ public final static String FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES = "org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries"; //$NON-NLS-1$ >+ >+ /** >+ * <pre> > * FORMATTER / Option to compact else/if > * - option id: "org.eclipse.jdt.core.formatter.compact_else_if" > * - possible values: { TRUE, FALSE } >Index: formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java,v >retrieving revision 1.99 >diff -u -r1.99 DefaultCodeFormatterOptions.java >--- formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 23 Feb 2010 10:56:18 -0000 1.99 >+++ formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 23 Feb 2010 11:30:22 -0000 >@@ -100,8 +100,8 @@ > > public boolean comment_clear_blank_lines_in_javadoc_comment; > public boolean comment_clear_blank_lines_in_block_comment; >- public boolean comment_condensed_block_comment; >- public boolean comment_condensed_javadoc_comment; >+ public boolean comment_new_lines_at_block_boundaries; >+ public boolean comment_new_lines_at_javadoc_boundaries; > public boolean comment_format_javadoc_comment; > public boolean comment_format_line_comment; > public boolean comment_format_block_comment; >@@ -371,8 +371,8 @@ > options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_SWITCH, this.brace_position_for_switch); > options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_BLOCK_COMMENT, this.comment_clear_blank_lines_in_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); > options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CLEAR_BLANK_LINES_IN_JAVADOC_COMMENT, this.comment_clear_blank_lines_in_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); >- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT, this.comment_condensed_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); >- options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT, this.comment_condensed_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); >+ options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES, this.comment_new_lines_at_block_boundaries ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); >+ options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES, this.comment_new_lines_at_javadoc_boundaries ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); > options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT, this.comment_format_javadoc_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); > options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_LINE_COMMENT, this.comment_format_line_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); > options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT, this.comment_format_block_comment ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); >@@ -1105,13 +1105,13 @@ > this.comment_line_length = 80; > } > } >- final Object commentCondensedBlockCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_BLOCK_COMMENT); >- if (commentCondensedBlockCommentOption != null) { >- this.comment_condensed_block_comment = DefaultCodeFormatterConstants.TRUE.equals(commentCondensedBlockCommentOption); >- } >- final Object commentCondensedJavadocCommentOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_CONDENSED_JAVADOC_COMMENT); >- if (commentCondensedJavadocCommentOption != null) { >- this.comment_condensed_javadoc_comment = DefaultCodeFormatterConstants.TRUE.equals(commentCondensedJavadocCommentOption); >+ final Object commentNewLinesAtBlockBoundariesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_BLOCK_BOUNDARIES); >+ if (commentNewLinesAtBlockBoundariesOption != null) { >+ this.comment_new_lines_at_block_boundaries = DefaultCodeFormatterConstants.TRUE.equals(commentNewLinesAtBlockBoundariesOption); >+ } >+ final Object commentNewLinesAtJavadocBoundariesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEW_LINES_AT_JAVADOC_BOUNDARIES); >+ if (commentNewLinesAtJavadocBoundariesOption != null) { >+ this.comment_new_lines_at_javadoc_boundaries = DefaultCodeFormatterConstants.TRUE.equals(commentNewLinesAtJavadocBoundariesOption); > } > final Object indentStatementsCompareToBlockOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INDENT_STATEMENTS_COMPARE_TO_BLOCK); > if (indentStatementsCompareToBlockOption != null) { >@@ -2024,6 +2024,8 @@ > this.comment_indent_root_tags = true; > this.comment_insert_empty_line_before_root_tags = true; > this.comment_insert_new_line_for_parameter = true; >+ this.comment_new_lines_at_block_boundaries = true; >+ this.comment_new_lines_at_javadoc_boundaries = true; > this.comment_line_length = 80; > this.continuation_indentation = 2; > this.continuation_indentation_for_array_initializer = 2; >@@ -2291,6 +2293,8 @@ > this.comment_indent_root_tags = true; > this.comment_insert_empty_line_before_root_tags = true; > this.comment_insert_new_line_for_parameter = true; >+ this.comment_new_lines_at_block_boundaries = true; >+ this.comment_new_lines_at_javadoc_boundaries = true; > this.comment_line_length = 80; > this.continuation_indentation = 2; > this.continuation_indentation_for_array_initializer = 2; >Index: formatter/org/eclipse/jdt/internal/formatter/Scribe.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Scribe.java,v >retrieving revision 1.193 >diff -u -r1.193 Scribe.java >--- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 22 Feb 2010 12:59:54 -0000 1.193 >+++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 23 Feb 2010 11:30:24 -0000 >@@ -1628,7 +1628,7 @@ > boolean firstWord = true; > boolean clearBlankLines = this.formatter.preferences.comment_clear_blank_lines_in_block_comment; > boolean joinLines = this.formatter.preferences.join_lines_in_comments; >- boolean condensed = this.formatter.preferences.comment_condensed_block_comment; >+ boolean newLinesAtBoundaries = this.formatter.preferences.comment_new_lines_at_block_boundaries; > int scannerLine = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, 0, this.maxLines); > int firstLine = scannerLine; > int lineNumber = scannerLine; >@@ -1688,7 +1688,7 @@ > this.column += tokensBuffer.length(); > } > // end of comment >- if (!condensed) { >+ if (newLinesAtBoundaries) { > if (multiLines || hasMultiLines) { > buffer.append(this.lineSeparator); > this.column = 1; >@@ -1739,7 +1739,7 @@ > int max; > lineNumber = Util.getLineNumber(this.scanner.currentPosition, this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines); > if (lastTextLine == -1) { >- linesGap = condensed ? 0 : lineNumber - firstLine; >+ linesGap = newLinesAtBoundaries ? lineNumber - firstLine : 0; > max = 0; > } else { > linesGap = lineNumber - lastTextLine; >@@ -1877,7 +1877,7 @@ > } > > private void printBlockCommentHeaderLine(StringBuffer buffer) { >- if (this.formatter.preferences.comment_condensed_block_comment) { >+ if (!this.formatter.preferences.comment_new_lines_at_block_boundaries) { > buffer.insert(0, ' '); > this.column++; > } >@@ -3283,7 +3283,7 @@ > printJavadocBlock(previousBlock); > > // format the header and footer empty spaces >- int newLines = (!this.formatter.preferences.comment_condensed_javadoc_comment && (this.line > currentLine || javadoc.isMultiLine())) ? 1 : 0; >+ int newLines = (this.formatter.preferences.comment_new_lines_at_javadoc_boundaries && (this.line > currentLine || javadoc.isMultiLine())) ? 1 : 0; > printJavadocGapLines(javadoc.textStart, firstBlockStart-1, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, false, null); > printJavadocGapLines(previousBlock.sourceEnd+1, javadoc.textEnd, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, true, null); > } >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java,v >retrieving revision 1.54 >diff -u -r1.54 FormatterCommentsBugsTest.java >--- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 22 Feb 2010 12:59:48 -0000 1.54 >+++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 23 Feb 2010 11:30:28 -0000 >@@ -5564,7 +5564,7 @@ > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=270209" > */ > public void testBug270209_Block01() throws JavaModelException { >- this.formatterPrefs.comment_condensed_block_comment = true; >+ this.formatterPrefs.comment_new_lines_at_block_boundaries = false; > String source = > "public interface X01 {\n" + > "\n" + >@@ -5582,7 +5582,7 @@ > ); > } > public void testBug270209_Block02() throws JavaModelException { >- this.formatterPrefs.comment_condensed_block_comment = true; >+ this.formatterPrefs.comment_new_lines_at_block_boundaries = false; > String source = > "public interface X02 {\n" + > "\n" + >@@ -5602,7 +5602,7 @@ > ); > } > public void testBug270209_Block03() throws JavaModelException { >- this.formatterPrefs.comment_condensed_block_comment = true; >+ this.formatterPrefs.comment_new_lines_at_block_boundaries = false; > String source = > "public interface X03 {\n" + > "\n" + >@@ -5624,7 +5624,7 @@ > ); > } > public void testBug270209_Javadoc01() throws JavaModelException { >- this.formatterPrefs.comment_condensed_javadoc_comment = true; >+ this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; > String source = > "public interface X01 {\n" + > "\n" + >@@ -5642,7 +5642,7 @@ > ); > } > public void testBug270209_Javadoc02() throws JavaModelException { >- this.formatterPrefs.comment_condensed_javadoc_comment = true; >+ this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; > String source = > "public interface X02 {\n" + > "\n" + >@@ -5662,7 +5662,7 @@ > ); > } > public void testBug270209_Javadoc03() throws JavaModelException { >- this.formatterPrefs.comment_condensed_javadoc_comment = true; >+ this.formatterPrefs.comment_new_lines_at_javadoc_boundaries = false; > String source = > "public interface X03 {\n" + > "\n" +
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 270209
:
159663
|
159665
|
159770
|
159911
|
159912