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 167087 Details for
Bug 311582
[formatter] Master switch to enable/disable on/off tags
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v01.txt (text/plain), 16.36 KB, created by
Frederic Fusier
on 2010-05-05 04:57:38 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2010-05-05 04:57:38 EDT
Size:
16.36 KB
patch
obsolete
>### 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 @@ > <br>Project org.eclipse.jdt.core v_A50 > (<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A50">cvs</a>). > <h2>What's new in this drop</h2> >+<ul> >+<li> >+Added a new preference to switch on/off the usage of the disabling/enabling tags of the formatter. >+<p> >+This new preference is controlled with the option:</p> >+<code>DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS</code> >+<pre> >+/** >+ * 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 >+ */ >+</pre> >+See bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582">311582</a> for more details. >+</li> >+</ul> > > <h3>Problem Reports Fixed</h3> > <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302295">302295</a> >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.110 >diff -u -r1.110 DefaultCodeFormatterConstants.java >--- formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 4 Mar 2010 16:48:50 -0000 1.110 >+++ formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java 5 May 2010 08:55:46 -0000 >@@ -860,10 +860,22 @@ > public static final String FORMATTER_CONTINUATION_INDENTATION_FOR_ARRAY_INITIALIZER = JavaCore.PLUGIN_ID + ".formatter.continuation_indentation_for_array_initializer"; //$NON-NLS-1$ > /** > * <pre> >+ * 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 >+ * </pre> >+ * @since 3.6 >+ */ >+ public static final String FORMATTER_USE_ON_OFF_TAGS = JavaCore.PLUGIN_ID + ".formatter.use_on_off_tags"; //$NON-NLS-1$ >+ /** >+ * <pre> > * 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. > * </pre> > * > * <p> >@@ -945,8 +957,7 @@ > public static final String FORMATTER_DISABLING_TAG = JavaCore.PLUGIN_ID + ".formatter.disabling_tag"; //$NON-NLS-1$ > /** > * <pre> >- * 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 =
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 311582
:
167087
|
167117
|
167178
|
167276