Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Fusier2008-04-27 16:28:49 +0000
committerFrederic Fusier2008-04-27 16:28:49 +0000
commit62f8132aa6e66bc79d2cfcc69b7efa69d325d62b (patch)
tree6289cc47f35e7cac0865063c3142906ea56825fb /org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
parent7315a9946428ac17ed2f3c53c5f292f76322b904 (diff)
downloadeclipse.jdt.core-62f8132aa6e66bc79d2cfcc69b7efa69d325d62b.tar.gz
eclipse.jdt.core-62f8132aa6e66bc79d2cfcc69b7efa69d325d62b.tar.xz
eclipse.jdt.core-62f8132aa6e66bc79d2cfcc69b7efa69d325d62b.zip
HEAD - 102780 and 227043 fixes tuning (17+8/64)
Diffstat (limited to 'org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java')
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java52
1 files changed, 26 insertions, 26 deletions
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index 7e9732fd62..22d00470c0 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -61,13 +61,13 @@ public class DefaultCodeFormatter extends CodeFormatter {
* released.
* The default is to enable old version of formatting to minimize impacts on
* existing clients.
- * TODO (eric) remove when bug 102780 will have been stabilized
+ * TODO remove when bugs 102780 & 227043 will have been stabilized
*/
private final static String NEW_COMMENTS_FORMAT = System.getProperty("org.eclipse.jdt.core.formatter.comments.new"); //$NON-NLS-1$
- private static final boolean ENABLE_NEW_COMMENTS_FORMAT = JavaCore.ENABLED.equals(NEW_COMMENTS_FORMAT);
- private static final boolean FORCE_NEW_COMMENTS_FORMAT = "forced".equals(NEW_COMMENTS_FORMAT); //$NON-NLS-1$
- private static final String WARNING_FORMAT_COMMENTS = "WARNING: Comments are still formatted using regions!"; //$NON-NLS-1$
- private static boolean PRINTED_FORMAT_COMMENTS_WARNING = false;
+ public static final boolean ENABLE_NEW_COMMENTS_FORMAT = !JavaCore.DISABLED.equals(NEW_COMMENTS_FORMAT);
+// private static final boolean FORCE_NEW_COMMENTS_FORMAT = "forced".equals(NEW_COMMENTS_FORMAT); //$NON-NLS-1$
+// private static final String WARNING_FORMAT_COMMENTS = "WARNING: Comments are still formatted using regions!"; //$NON-NLS-1$
+// private static boolean PRINTED_FORMAT_COMMENTS_WARNING = false;
// Scanner use to probe the kind of the source given to the formatter
private static Scanner PROBING_SCANNER;
@@ -179,24 +179,24 @@ public class DefaultCodeFormatter extends CodeFormatter {
if (ENABLE_NEW_COMMENTS_FORMAT) {
return formatComment(kind & K_MASK, source, indentationLevel, lineSeparator, new IRegion[] {new Region(offset, length)});
}
- if (FORCE_NEW_COMMENTS_FORMAT) {
- // Skip the javadoc formatting using this constant
- return null;
- }
- // In all other cases, use the old way to format javadoc comments
- if (!PRINTED_FORMAT_COMMENTS_WARNING) {
- if (DEBUG) System.out.println(WARNING_FORMAT_COMMENTS);
- PRINTED_FORMAT_COMMENTS_WARNING = true;
- }
+// if (FORCE_NEW_COMMENTS_FORMAT) {
+// // Skip the javadoc formatting using this constant
+// return null;
+// }
+// // In all other cases, use the old way to format javadoc comments
+// if (!PRINTED_FORMAT_COMMENTS_WARNING) {
+// if (DEBUG) System.out.println(WARNING_FORMAT_COMMENTS);
+// PRINTED_FORMAT_COMMENTS_WARNING = true;
+// }
case K_MULTI_LINE_COMMENT :
case K_SINGLE_LINE_COMMENT :
if (ENABLE_NEW_COMMENTS_FORMAT) {
return formatComment(kind & K_MASK, source, indentationLevel, lineSeparator, new IRegion[] {new Region(offset, length)});
}
- if (FORCE_NEW_COMMENTS_FORMAT) {
- // Skip the javadoc formatting using this constant
- return null;
- }
+// if (FORCE_NEW_COMMENTS_FORMAT) {
+// // Skip the javadoc formatting using this constant
+// return null;
+// }
this.codeSnippetParsingUtil = new CodeSnippetParsingUtil();
return formatComment(kind, source, indentationLevel, lineSeparator, new IRegion[] {new Region(offset, length)}, false);
}
@@ -217,14 +217,14 @@ public class DefaultCodeFormatter extends CodeFormatter {
case K_CLASS_BODY_DECLARATIONS :
return formatClassBodyDeclarations(source, indentationLevel, lineSeparator, regions);
case K_COMPILATION_UNIT :
- boolean includeComments = (kind & F_INCLUDE_COMMENTS) != 0 || FORCE_NEW_COMMENTS_FORMAT;
+ boolean includeComments = (kind & F_INCLUDE_COMMENTS) != 0; // || FORCE_NEW_COMMENTS_FORMAT;
return formatCompilationUnit(source, indentationLevel, lineSeparator, regions, includeComments);
case K_EXPRESSION :
return formatExpression(source, indentationLevel, lineSeparator, regions);
case K_STATEMENTS :
return formatStatements(source, indentationLevel, lineSeparator, regions);
case K_UNKNOWN :
- includeComments = (kind & F_INCLUDE_COMMENTS) != 0 || FORCE_NEW_COMMENTS_FORMAT;
+ includeComments = (kind & F_INCLUDE_COMMENTS) != 0; // || FORCE_NEW_COMMENTS_FORMAT;
return probeFormatting(source, indentationLevel, lineSeparator, regions, includeComments);
case K_JAVA_DOC :
case K_MULTI_LINE_COMMENT :
@@ -538,14 +538,14 @@ public class DefaultCodeFormatter extends CodeFormatter {
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=227043
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102780
// use the integrated comment formatter to format comment
- if (ENABLE_NEW_COMMENTS_FORMAT || FORCE_NEW_COMMENTS_FORMAT) {
+ if (ENABLE_NEW_COMMENTS_FORMAT /*|| FORCE_NEW_COMMENTS_FORMAT*/) {
return formatComment(kind, source, indentationLevel, lineSeparator, regions);
}
- // In all other cases, use the old way to format javadoc comments
- if (!PRINTED_FORMAT_COMMENTS_WARNING) {
- if (DEBUG) System.out.println(WARNING_FORMAT_COMMENTS);
- PRINTED_FORMAT_COMMENTS_WARNING = true;
- }
+// // In all other cases, use the old way to format javadoc comments
+// if (!PRINTED_FORMAT_COMMENTS_WARNING) {
+// if (DEBUG) System.out.println(WARNING_FORMAT_COMMENTS);
+// PRINTED_FORMAT_COMMENTS_WARNING = true;
+// }
return formatComment(kind, source, indentationLevel, lineSeparator, regions, includeComments);
}
} catch (InvalidInputException e) {

Back to the top