### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: buildnotes_jdt-core.html
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v
retrieving revision 1.7442
diff -u -r1.7442 buildnotes_jdt-core.html
--- buildnotes_jdt-core.html 4 May 2010 19:15:29 -0000 1.7442
+++ buildnotes_jdt-core.html 5 May 2010 08:55:46 -0000
@@ -48,6 +48,25 @@
Project org.eclipse.jdt.core v_A50
(cvs).
+This new preference is controlled with the option:
+DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS
++/** + * FORMATTER / Option to use the disabling and enabling tags defined respectively by the {@link #FORMATTER_DISABLING_TAG} and the {@link #FORMATTER_ENABLING_TAG} options. + * - option id: "org.eclipse.jdt.core.formatter.use_on_off_tags" + * - possible values: TRUE / FALSE + * - default: FALSE + * + * @since 3.6 + */ ++See bug 311582 for more details. +
+ * FORMATTER / Option to use the disabling and enabling tags defined respectively by the {@link #FORMATTER_DISABLING_TAG} and the {@link #FORMATTER_ENABLING_TAG} options. + * - option id: "org.eclipse.jdt.core.formatter.use_on_off_tags" + * - possible values: TRUE / FALSE + * - default: FALSE + *+ * @since 3.6 + */ + public static final String FORMATTER_USE_ON_OFF_TAGS = JavaCore.PLUGIN_ID + ".formatter.use_on_off_tags"; //$NON-NLS-1$ + /** + *
* FORMATTER / Option to define the tag to put in a comment to disable the formatting. - * See the {@link #FORMATTER_ENABLING_TAG} option to re-enable it. + * - option id: "org.eclipse.jdt.core.formatter.disabling_tag" * - possible values: String, with constraints mentioned below * - default: "" + * + * See the {@link #FORMATTER_ENABLING_TAG} option to re-enable it. ** *
@@ -945,8 +957,7 @@ public static final String FORMATTER_DISABLING_TAG = JavaCore.PLUGIN_ID + ".formatter.disabling_tag"; //$NON-NLS-1$ /** *
- * FORMATTER / Option to define the tag to put in a comment to re-enable the - * formatting after it has been disabled (see {@link #FORMATTER_DISABLING_TAG}) + * FORMATTER / Option to define the tag to put in a comment to re-enable the formatting after it has been disabled (see {@link #FORMATTER_DISABLING_TAG}) * - option id: "org.eclipse.jdt.core.formatter.enabling_tag" * - possible values: String, with constraints mentioned below * - default: "" 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.105 diff -u -r1.105 DefaultCodeFormatterOptions.java --- formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 3 Mar 2010 11:16:59 -0000 1.105 +++ formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java 5 May 2010 08:55:47 -0000 @@ -117,6 +117,7 @@ public boolean comment_insert_new_line_for_parameter; public int comment_line_length; + public boolean use_tags; public char[] disabling_tag; public char[] enabling_tag; @@ -618,6 +619,7 @@ options.put(DefaultCodeFormatterConstants.FORMATTER_WRAP_BEFORE_BINARY_OPERATOR, this.wrap_before_binary_operator ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, this.disabling_tag == null ? Util.EMPTY_STRING : new String(this.disabling_tag)); options.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, this.enabling_tag == null ? Util.EMPTY_STRING : new String(this.enabling_tag)); + options.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, this.use_tags ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); return options; } @@ -1955,6 +1957,10 @@ if (wrapBeforeBinaryOperatorOption != null) { this.wrap_before_binary_operator = DefaultCodeFormatterConstants.TRUE.equals(wrapBeforeBinaryOperatorOption); } + final Object useTags = settings.get(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS); + if (useTags != null) { + this.use_tags = DefaultCodeFormatterConstants.TRUE.equals(useTags); + } final Object disableTagOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG); if (disableTagOption != null) { if (disableTagOption instanceof String) { @@ -2299,6 +2305,7 @@ this.tab_char = TAB; // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=49081 this.use_tabs_only_for_leading_indentations = false; this.wrap_before_binary_operator = true; + this.use_tags = false; } public void setEclipseDefaultSettings() { @@ -2570,5 +2577,6 @@ this.tab_char = MIXED; this.use_tabs_only_for_leading_indentations = false; this.wrap_before_binary_operator = true; + this.use_tags = false; } } 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.207 diff -u -r1.207 Scribe.java --- formatter/org/eclipse/jdt/internal/formatter/Scribe.java 4 May 2010 08:45:55 -0000 1.207 +++ formatter/org/eclipse/jdt/internal/formatter/Scribe.java 5 May 2010 08:55:48 -0000 @@ -106,7 +106,8 @@ int blank_lines_between_import_groups = -1; /** disabling */ - boolean editsEnabled = true; + boolean editsEnabled; + boolean useTags; /* Comments formatting */ private static final int INCLUDE_BLOCK_COMMENTS = CodeFormatter.F_INCLUDE_COMMENTS | CodeFormatter.K_MULTI_LINE_COMMENT; @@ -1382,21 +1383,23 @@ } private void initializeScanner(long sourceLevel, DefaultCodeFormatterOptions preferences) { - this.disablingTag = preferences.disabling_tag; - this.enablingTag = preferences.enabling_tag; - char[][] taskTags; - if (this.disablingTag == null) { - if (this.enablingTag == null) { - taskTags = null; + this.useTags = preferences.use_tags; + char[][] taskTags = null; + if (this.useTags) { + this.disablingTag = preferences.disabling_tag; + this.enablingTag = preferences.enabling_tag; + if (this.disablingTag == null) { + if (this.enablingTag != null) { + taskTags = new char[][] { this.enablingTag }; + } + } else if (this.enablingTag == null) { + taskTags = new char[][] { this.disablingTag }; } else { - taskTags = new char[][] { this.enablingTag }; + taskTags = new char[][] { this.disablingTag, this.enablingTag }; } - } else if (this.enablingTag == null) { - taskTags = new char[][] { this.disablingTag }; - } else { - taskTags = new char[][] { this.disablingTag, this.enablingTag }; } this.scanner = new Scanner(true, true, false/*nls*/, sourceLevel/*sourceLevel*/, taskTags, null/*taskPriorities*/, true/*taskCaseSensitive*/); + this.editsEnabled = true; } private void initFormatterCommentParser() { #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java,v retrieving revision 1.27 diff -u -r1.27 FormatterBugsTests.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 23 Apr 2010 10:04:33 -0000 1.27 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java 5 May 2010 08:55:50 -0000 @@ -101,6 +101,7 @@ ); } public void testBug027079a1() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -130,6 +131,7 @@ ); } public void testBug027079a2() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -159,6 +161,7 @@ ); } public void testBug027079a3() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -188,6 +191,7 @@ ); } public void testBug027079a4() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -218,6 +222,7 @@ ); } public void testBug027079b() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -256,6 +261,7 @@ ); } public void testBug027079c() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -305,6 +311,7 @@ ); } public void testBug027079c2() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -352,6 +359,7 @@ ); } public void testBug027079d() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -386,6 +394,7 @@ true/*repeat*/); } public void testBug027079d2() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -420,6 +429,7 @@ true/*repeat*/); } public void testBug027079d3() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -454,6 +464,7 @@ true/*repeat*/); } public void testBug027079d4() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray(); this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray(); String source = @@ -488,6 +499,7 @@ true/*repeat*/); } public void testBug027079e() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "format: off".toCharArray(); this.formatterPrefs.enabling_tag = "format: on".toCharArray(); String source = @@ -517,6 +529,7 @@ ); } public void testBug027079f() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "format: off".toCharArray(); this.formatterPrefs.enabling_tag = "format: on".toCharArray(); String source = @@ -546,6 +559,7 @@ ); } public void testBug027079f2() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "format: off".toCharArray(); this.formatterPrefs.enabling_tag = "format: on".toCharArray(); String source = @@ -575,6 +589,7 @@ ); } public void testBug027079f3() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = " format: off ".toCharArray(); this.formatterPrefs.enabling_tag = " format: on ".toCharArray(); String source = @@ -604,6 +619,7 @@ ); } public void testBug027079f4() throws JavaModelException { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = " format: off ".toCharArray(); this.formatterPrefs.enabling_tag = " format: on ".toCharArray(); String source = @@ -5839,6 +5855,7 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=304529" */ public void testBug304529() { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = "off".toCharArray(); this.formatterPrefs.enabling_tag = null; String source = @@ -5851,6 +5868,7 @@ formatSource(source); } public void testBug304529b() { + this.formatterPrefs.use_tags = true; this.formatterPrefs.disabling_tag = null; this.formatterPrefs.enabling_tag = "on".toCharArray(); String source = @@ -5871,6 +5889,7 @@ } public void testBug304529c() { this.formatterPrefs = null; + this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "off"); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, ""); String source = @@ -5884,6 +5903,7 @@ } public void testBug304529d() { this.formatterPrefs = null; + this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, ""); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "on"); String source = @@ -5904,6 +5924,7 @@ } public void testBug304529e() { this.formatterPrefs = null; + this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "off"); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "on"); String source = 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.64 diff -u -r1.64 FormatterCommentsBugsTest.java --- src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 25 Apr 2010 18:23:04 -0000 1.64 +++ src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java 5 May 2010 08:55:51 -0000 @@ -6262,6 +6262,7 @@ */ public void testBug305281() { this.formatterPrefs = null; + this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "format: OFF"); this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "format: ON"); String source =