diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java index d74172750fd..1a1bcc7fa56 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter/DefaultCodeFormatterConstants.java @@ -1134,6 +1134,18 @@ public class DefaultCodeFormatterConstants { * @see CCorePlugin#DO_NOT_INSERT */ public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_method_invocation"; //$NON-NLS-1$ + /** + *
+ * FORMATTER / Option to insert a space after the opening parenthesis in an exception specification + * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: DO_NOT_INSERT + *+ * @see CCorePlugin#INSERT + * @see CCorePlugin#DO_NOT_INSERT + * @since 5.1 + */ + public static final String FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_opening_paren_in_exception_specification"; //$NON-NLS-1$ /** *
* FORMATTER / Option to insert a space after the opening parenthesis in a parenthesized expression @@ -1354,6 +1366,18 @@ public class DefaultCodeFormatterConstants { * @see CCorePlugin#DO_NOT_INSERT */ public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_method_invocation"; //$NON-NLS-1$ + /** + *+ * FORMATTER / Option to insert a space before the closing parenthesis in an exception specification + * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: DO_NOT_INSERT + *+ * @see CCorePlugin#INSERT + * @see CCorePlugin#DO_NOT_INSERT + * @since 5.1 + */ + public static final String FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_closing_paren_in_exception_specification"; //$NON-NLS-1$ /** ** FORMATTER / Option to insert a space before the closing parenthesis in a parenthesized expression @@ -1750,12 +1774,24 @@ public class DefaultCodeFormatterConstants { * @see CCorePlugin#DO_NOT_INSERT */ public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_method_invocation"; //$NON-NLS-1$ + /** + *+ * FORMATTER / Option to insert a space before the opening parenthesis in an exception specification + * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: DO_NOT_INSERT + *+ * @see CCorePlugin#INSERT + * @see CCorePlugin#DO_NOT_INSERT + * @since 5.1 + */ + public static final String FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_opening_paren_in_exception_specification"; //$NON-NLS-1$ /** ** FORMATTER / Option to insert a space before the opening parenthesis in a parenthesized expression * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" * - possible values: { INSERT, DO_NOT_INSERT } - * - default: DO_NOT_INSERT + * - default: INSERT ** @see CCorePlugin#INSERT * @see CCorePlugin#DO_NOT_INSERT @@ -1905,6 +1941,18 @@ public class DefaultCodeFormatterConstants { * @see CCorePlugin#DO_NOT_INSERT */ public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_method_invocation"; //$NON-NLS-1$ + /** + *+ * FORMATTER / Option to insert a space between empty parenthesis in an exception specification + * - option id: "org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" + * - possible values: { INSERT, DO_NOT_INSERT } + * - default: DO_NOT_INSERT + *+ * @see CCorePlugin#INSERT + * @see CCorePlugin#DO_NOT_INSERT + * @since 5.1 + */ + public static final String FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_between_empty_parens_in_exception_specification"; //$NON-NLS-1$ /** ** FORMATTER / Option to keep else statement on the same line diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java index 2471bcbab6e..d745249f888 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/CodeFormatterVisitor.java @@ -1084,14 +1084,12 @@ public class CodeFormatterVisitor extends CPPASTVisitor { try { scribe.alignFragment(alignment, 0); scribe.printNextToken(Token.t_throw, true); - // preferences.insert_space_before_opening_paren_in_exception_specification_throw - scribe.printNextToken(Token.tLPAREN, scribe.printComment()); - if (false /* preferences.insert_space_after_opening_paren_in_exception_specification_throw */ ) { + scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_exception_specification); + if (preferences.insert_space_after_opening_paren_in_exception_specification) { scribe.space(); } exceptionSpecification[0].accept(this); for (int i = 1; i < exceptionSpecification.length; i++) { - // insert_space_before_comma_in_method_declaration_throws scribe.printNextToken(Token.tCOMMA, preferences.insert_space_before_comma_in_method_declaration_throws); scribe.printTrailingComment(); if (preferences.insert_space_after_comma_in_method_declaration_throws) { @@ -1101,8 +1099,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor { exceptionSpecification[i].accept(this); } if (peekNextToken() == Token.tRPAREN) { - // preferences.insert_space_before_closing_paren_in_exception_specification_throw - scribe.printNextToken(Token.tRPAREN, scribe.printComment()); + scribe.printNextToken(Token.tRPAREN, preferences.insert_space_before_closing_paren_in_exception_specification); } ok = true; } catch (AlignmentException e) { @@ -1112,8 +1109,8 @@ public class CodeFormatterVisitor extends CPPASTVisitor { scribe.exitAlignment(alignment, true); } else { scribe.printNextToken(Token.t_throw, true); - scribe.printNextToken(Token.tLPAREN, scribe.printComment()); - scribe.printNextToken(Token.tRPAREN, scribe.printComment()); + scribe.printNextToken(Token.tLPAREN, preferences.insert_space_before_opening_paren_in_exception_specification); + scribe.printNextToken(Token.tRPAREN, preferences.insert_space_between_empty_parens_in_exception_specification); } } diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java index 6a1b9205527..af5e0a5822b 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter/DefaultCodeFormatterOptions.java @@ -157,6 +157,7 @@ public class DefaultCodeFormatterOptions { public boolean insert_space_after_opening_paren_in_if; public boolean insert_space_after_opening_paren_in_method_declaration; public boolean insert_space_after_opening_paren_in_method_invocation; + public boolean insert_space_after_opening_paren_in_exception_specification; public boolean insert_space_after_opening_paren_in_parenthesized_expression; public boolean insert_space_after_opening_paren_in_switch; public boolean insert_space_after_opening_paren_in_while; @@ -177,6 +178,7 @@ public class DefaultCodeFormatterOptions { public boolean insert_space_before_closing_paren_in_if; public boolean insert_space_before_closing_paren_in_method_declaration; public boolean insert_space_before_closing_paren_in_method_invocation; + public boolean insert_space_before_closing_paren_in_exception_specification; public boolean insert_space_before_closing_paren_in_parenthesized_expression; public boolean insert_space_before_closing_paren_in_switch; public boolean insert_space_before_closing_paren_in_while; @@ -212,6 +214,7 @@ public class DefaultCodeFormatterOptions { public boolean insert_space_before_opening_paren_in_for; public boolean insert_space_before_opening_paren_in_if; public boolean insert_space_before_opening_paren_in_method_invocation; + public boolean insert_space_before_opening_paren_in_exception_specification; public boolean insert_space_before_opening_paren_in_method_declaration; public boolean insert_space_before_opening_paren_in_switch; public boolean insert_space_before_opening_brace_in_switch; @@ -227,6 +230,7 @@ public class DefaultCodeFormatterOptions { public boolean insert_space_between_empty_brackets; public boolean insert_space_between_empty_parens_in_method_declaration; public boolean insert_space_between_empty_parens_in_method_invocation; + public boolean insert_space_between_empty_parens_in_exception_specification; public boolean compact_else_if; public boolean keep_guardian_clause_on_one_line; public boolean keep_else_statement_on_same_line; @@ -353,6 +357,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, this.insert_space_after_opening_paren_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, this.insert_space_after_opening_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_after_opening_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, this.insert_space_after_opening_paren_in_exception_specification? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_after_opening_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_after_opening_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, this.insert_space_after_opening_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); @@ -373,6 +378,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, this.insert_space_before_closing_paren_in_for? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, this.insert_space_before_closing_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_closing_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, this.insert_space_before_closing_paren_in_exception_specification? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_closing_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_closing_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, this.insert_space_before_closing_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); @@ -409,6 +415,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, this.insert_space_before_opening_paren_in_if? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, this.insert_space_before_opening_paren_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, this.insert_space_before_opening_paren_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, this.insert_space_before_opening_paren_in_exception_specification? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, this.insert_space_before_opening_paren_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, this.insert_space_before_opening_brace_in_switch? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, this.insert_space_before_opening_paren_in_parenthesized_expression? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); @@ -424,6 +431,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS, this.insert_space_between_empty_brackets? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, this.insert_space_between_empty_parens_in_method_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, this.insert_space_between_empty_parens_in_method_invocation? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION, this.insert_space_between_empty_parens_in_exception_specification? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF, this.compact_else_if ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_GUARDIAN_CLAUSE_ON_ONE_LINE, this.keep_guardian_clause_on_one_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_KEEP_ELSE_STATEMENT_ON_SAME_LINE, this.keep_else_statement_on_same_line ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); @@ -1018,6 +1026,10 @@ public class DefaultCodeFormatterOptions { if (insertSpaceAfterOpeningParenInMethodDeclarationOption != null) { this.insert_space_after_opening_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInMethodDeclarationOption); } + final Object insertSpaceAfterOpeningParenInExceptionSpecificationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION); + if (insertSpaceAfterOpeningParenInExceptionSpecificationOption != null) { + this.insert_space_after_opening_paren_in_exception_specification = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInExceptionSpecificationOption); + } final Object insertSpaceAfterOpeningParenInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION); if (insertSpaceAfterOpeningParenInMethodInvocationOption != null) { this.insert_space_after_opening_paren_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceAfterOpeningParenInMethodInvocationOption); @@ -1098,6 +1110,10 @@ public class DefaultCodeFormatterOptions { if (insertSpaceBeforeClosingParenInMethodDeclarationOption != null) { this.insert_space_before_closing_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInMethodDeclarationOption); } + final Object insertSpaceBeforeClosingParenInExceptionSpecificationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION); + if (insertSpaceBeforeClosingParenInExceptionSpecificationOption != null) { + this.insert_space_before_closing_paren_in_exception_specification = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInExceptionSpecificationOption); + } final Object insertSpaceBeforeClosingParenInMethodInvocationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION); if (insertSpaceBeforeClosingParenInMethodInvocationOption != null) { this.insert_space_before_closing_paren_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceBeforeClosingParenInMethodInvocationOption); @@ -1242,6 +1258,10 @@ public class DefaultCodeFormatterOptions { if (insertSpaceBeforeOpeningParenInMethodDeclarationOption != null) { this.insert_space_before_opening_paren_in_method_declaration = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInMethodDeclarationOption); } + final Object insertSpaceBeforeOpeningParenInExceptionSpecificationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION); + if (insertSpaceBeforeOpeningParenInExceptionSpecificationOption != null) { + this.insert_space_before_opening_paren_in_exception_specification = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInExceptionSpecificationOption); + } final Object insertSpaceBeforeOpeningParenInSwitchOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH); if (insertSpaceBeforeOpeningParenInSwitchOption != null) { this.insert_space_before_opening_paren_in_switch = CCorePlugin.INSERT.equals(insertSpaceBeforeOpeningParenInSwitchOption); @@ -1302,6 +1322,10 @@ public class DefaultCodeFormatterOptions { if (insertSpaceBetweenEmptyParensInMethodInvocationOption != null) { this.insert_space_between_empty_parens_in_method_invocation = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInMethodInvocationOption); } + final Object insertSpaceBetweenEmptyParensInExceptionSpecificationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION); + if (insertSpaceBetweenEmptyParensInExceptionSpecificationOption != null) { + this.insert_space_between_empty_parens_in_exception_specification = CCorePlugin.INSERT.equals(insertSpaceBetweenEmptyParensInExceptionSpecificationOption); + } final Object compactElseIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_COMPACT_ELSE_IF); if (compactElseIfOption != null) { this.compact_else_if = DefaultCodeFormatterConstants.TRUE.equals(compactElseIfOption); @@ -1526,6 +1550,7 @@ public class DefaultCodeFormatterOptions { this.insert_space_before_opening_brace_in_namespace_declaration = true; this.insert_space_before_opening_bracket = false; this.insert_space_before_opening_paren_in_catch = true; + this.insert_space_before_opening_paren_in_exception_specification = true; this.insert_space_before_opening_paren_in_for = true; this.insert_space_before_opening_paren_in_if = true; this.insert_space_before_opening_paren_in_method_invocation = false; @@ -1543,6 +1568,7 @@ public class DefaultCodeFormatterOptions { this.insert_space_between_empty_brackets = false; this.insert_space_between_empty_parens_in_method_declaration = false; this.insert_space_between_empty_parens_in_method_invocation = false; + this.insert_space_between_empty_parens_in_exception_specification = false; this.compact_else_if = true; this.keep_guardian_clause_on_one_line = false; this.keep_else_statement_on_same_line = false; diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp index f6cb5823fd8..10b657596f0 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/bugs/After.cpp @@ -11,11 +11,11 @@ protected: ABaseClass(int x); }; class AClass: public ABaseClass { - AClass(int x) throw(int); - void test1() const throw(int); - void test2() throw(); + AClass(int x) throw (int); + void test1() const throw (int); + void test2() throw (); }; -AClass::AClass(int x) throw(int) : +AClass::AClass(int x) throw (int) : ABaseClass(x) { for (int i = 0; i < 12; i++) { } diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java index 1c90f036a3f..76f242a17b4 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/CodeFormatterTest.java @@ -222,7 +222,7 @@ public class CodeFormatterTest extends BaseUITestCase { //void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName() throw(float); //void functionWithLooooooooooooooooooooooooooooooooooooooooooooooooongName() - // throw(float); + // throw (float); public void testLineWrappingOfThrowSpecification_Bug200959() throws Exception { assertFormatterResult(); } @@ -523,10 +523,10 @@ public class CodeFormatterTest extends BaseUITestCase { //class Example: { // void foo() - // throw(int); + // throw (int); //}; //void Example::foo() - // throw(int) { + // throw (int) { //} public void testAlignmentOfExceptionSpecificationInMethodDeclaration_Bug191980() throws Exception { fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, @@ -1070,5 +1070,14 @@ public class CodeFormatterTest extends BaseUITestCase { public void testUniversalCharacters_Bug255949() throws Exception { assertFormatterResult(); } - + + //void foo() throw(E1,E2); + + //void foo() throw ( E1, E2 ); + public void testWhitespaceOptionsForExceptionSpecification_Bug243567() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, CCorePlugin.INSERT); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, CCorePlugin.INSERT); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, CCorePlugin.INSERT); + assertFormatterResult(); + } } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/BracesTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/BracesTabPage.java index 47e746be603..186b9c130fc 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/BracesTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/BracesTabPage.java @@ -127,7 +127,7 @@ public class BracesTabPage extends FormatterTabPage { createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_class_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_TYPE_DECLARATION); createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_namespace_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_NAMESPACE_DECLARATION); // createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_constructor_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_CONSTRUCTOR_DECLARATION); - createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_method_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION); + createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_function_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_METHOD_DECLARATION); // createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION); // createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_enumconst_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT); // createExtendedBracesCombo(group, numColumns, FormatterMessages.BracesTabPage_option_annotation_type_declaration, DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java index fa2156f6d19..d050d04ead0 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java @@ -52,8 +52,8 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceTabPage_classes_after_colon_of_base_clause; public static String WhiteSpaceTabPage_classes_before_comma_base_types; public static String WhiteSpaceTabPage_classes_after_comma_base_types; - public static String WhiteSpaceTabPage_methods; -// public static String WhiteSpaceTabPage_constructors; + public static String WhiteSpaceTabPage_functions; + public static String WhiteSpaceTabPage_exception_specifications; public static String WhiteSpaceTabPage_declarator_list; public static String WhiteSpaceTabPage_declarator_list_before_comma; public static String WhiteSpaceTabPage_declarator_list_after_comma; @@ -62,10 +62,8 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceTabPage_expression_list_after_comma; public static String WhiteSpaceTabPage_initializer_list; public static String WhiteSpaceTabPage_calls; - public static String WhiteSpaceTabPage_calls_before_comma_in_method_args; - public static String WhiteSpaceTabPage_calls_after_comma_in_method_args; -// public static String WhiteSpaceTabPage_calls_before_comma_in_alloc; -// public static String WhiteSpaceTabPage_calls_after_comma_in_alloc; + public static String WhiteSpaceTabPage_calls_before_comma_in_function_args; + public static String WhiteSpaceTabPage_calls_after_comma_in_function_args; public static String WhiteSpaceTabPage_statements; public static String WhiteSpaceTabPage_blocks; public static String WhiteSpaceTabPage_switch; @@ -101,10 +99,6 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceTabPage_between_empty_brackets; public static String WhiteSpaceTabPage_before_comma_in_params; public static String WhiteSpaceTabPage_after_comma_in_params; -// public static String WhiteSpaceTabPage_before_comma_in_throws; -// public static String WhiteSpaceTabPage_after_comma_in_throws; -// public static String WhiteSpaceTabPage_before_ellipsis; -// public static String WhiteSpaceTabPage_after_ellipsis; public static String WhiteSpaceTabPage_before_comma; public static String WhiteSpaceTabPage_after_comma; public static String WhiteSpaceTabPage_after_semicolon; @@ -138,16 +132,14 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceOptions_if; public static String WhiteSpaceOptions_switch; public static String WhiteSpaceOptions_while; - public static String WhiteSpaceOptions_member_function_declaration; -// public static String WhiteSpaceOptions_constructor; - public static String WhiteSpaceOptions_method; - public static String WhiteSpaceOptions_method_call; + public static String WhiteSpaceOptions_function_declaration; + public static String WhiteSpaceOptions_exception_specification; + public static String WhiteSpaceOptions_function; + public static String WhiteSpaceOptions_function_call; public static String WhiteSpaceOptions_paren_expr; public static String WhiteSpaceOptions_type_cast; -// public static String WhiteSpaceOptions_parameterized_type; public static String WhiteSpaceOptions_template_arguments; public static String WhiteSpaceOptions_template_parameters; -// public static String WhiteSpaceOptions_vararg_parameter; public static String WhiteSpaceOptions_closing_paren; public static String WhiteSpaceOptions_opening_brace; public static String WhiteSpaceOptions_closing_brace; @@ -159,8 +151,6 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceOptions_arrays; public static String WhiteSpaceOptions_arguments; public static String WhiteSpaceOptions_parameters; -// public static String WhiteSpaceOptions_alloc_expr; -// public static String WhiteSpaceOptions_throws; public static String WhiteSpaceOptions_lists; public static String WhiteSpaceOptions_expression_list; public static String WhiteSpaceOptions_declarator_list; @@ -173,8 +163,7 @@ final class FormatterMessages extends NLS { public static String WhiteSpaceOptions_between_empty_parens; public static String WhiteSpaceOptions_between_empty_braces; public static String WhiteSpaceOptions_between_empty_brackets; -// public static String WhiteSpaceOptions_constructor_decl; - public static String WhiteSpaceOptions_method_decl; + public static String WhiteSpaceOptions_function_decl; public static String WhiteSpaceOptions_case; public static String WhiteSpaceOptions_default; public static String WhiteSpaceOptions_statements; @@ -221,8 +210,7 @@ final class FormatterMessages extends NLS { public static String LineWrappingTabPage_indentation_on_column; public static String LineWrappingTabPage_indentation_by_one; public static String LineWrappingTabPage_class_decls; - public static String LineWrappingTabPage_method_decls; -// public static String LineWrappingTabPage_constructor_decls; + public static String LineWrappingTabPage_function_decls; public static String LineWrappingTabPage_function_calls; public static String LineWrappingTabPage_expressions; // public static String LineWrappingTabPage_statements; @@ -241,8 +229,7 @@ final class FormatterMessages extends NLS { public static String LineWrappingTabPage_indentation_on_column_lowercase; public static String LineWrappingTabPage_indentation_by_one_lowercase; public static String LineWrappingTabPage_class_decls_lowercase; - public static String LineWrappingTabPage_method_decls_lowercase; -// public static String LineWrappingTabPage_constructor_decls_lowercase; + public static String LineWrappingTabPage_function_decls_lowercase; public static String LineWrappingTabPage_function_calls_lowercase; public static String LineWrappingTabPage_expressions_lowercase; // public static String LineWrappingTabPage_statements_lowercase; @@ -299,8 +286,7 @@ final class FormatterMessages extends NLS { public static String BracesTabPage_group_brace_positions_title; public static String BracesTabPage_option_class_declaration; public static String BracesTabPage_option_namespace_declaration; - public static String BracesTabPage_option_method_declaration; -// public static String BracesTabPage_option_constructor_declaration; + public static String BracesTabPage_option_function_declaration; public static String BracesTabPage_option_blocks; public static String BracesTabPage_option_blocks_in_case; public static String BracesTabPage_option_switch_case; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties index e4873b185f9..a642bb4a2c4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties @@ -33,9 +33,7 @@ WhiteSpaceTabPage_classes_before_colon_of_base_clause=before colon of base claus WhiteSpaceTabPage_classes_after_colon_of_base_clause=after colon of base clause WhiteSpaceTabPage_classes_before_comma_base_types=before comma in base clause WhiteSpaceTabPage_classes_after_comma_base_types=after comma in base clause -WhiteSpaceTabPage_methods=Methods -#WhiteSpaceTabPage_constructors=Constructors - +WhiteSpaceTabPage_functions=Functions WhiteSpaceTabPage_declarator_list=Declarator list WhiteSpaceTabPage_declarator_list_before_comma=before comma in declarator list WhiteSpaceTabPage_declarator_list_after_comma=after comma in declarator list @@ -43,14 +41,12 @@ WhiteSpaceTabPage_expression_list=Expression list WhiteSpaceTabPage_expression_list_before_comma=before comma in expression list WhiteSpaceTabPage_expression_list_after_comma=after comma in expression list WhiteSpaceTabPage_initializer_list=Initializer list +WhiteSpaceTabPage_exception_specifications=Exception specifications WhiteSpaceTabPage_calls=Function invocations -WhiteSpaceTabPage_calls_before_comma_in_method_args=before comma in method arguments -WhiteSpaceTabPage_calls_after_comma_in_method_args=after comma in method arguments -#WhiteSpaceTabPage_calls_before_comma_in_alloc=before comma in object allocation arguments -#WhiteSpaceTabPage_calls_after_comma_in_alloc=after comma in object allocation arguments - +WhiteSpaceTabPage_calls_before_comma_in_function_args=before comma in function arguments +WhiteSpaceTabPage_calls_after_comma_in_function_args=after comma in function arguments WhiteSpaceTabPage_statements=Control statements WhiteSpaceTabPage_blocks=Blocks @@ -104,11 +100,6 @@ WhiteSpaceTabPage_between_empty_brackets=between empty brackets WhiteSpaceTabPage_before_comma_in_params=before comma in parameters WhiteSpaceTabPage_after_comma_in_params=after comma in parameters -#WhiteSpaceTabPage_before_comma_in_throws=before comma in 'throws' clause -#WhiteSpaceTabPage_after_comma_in_throws=after comma in 'throws' clause - -#WhiteSpaceTabPage_before_ellipsis=before ellipsis in vararg parameters -#WhiteSpaceTabPage_after_ellipsis=after ellipsis in vararg parameters WhiteSpaceTabPage_before_comma=before comma WhiteSpaceTabPage_after_comma=after comma @@ -148,17 +139,15 @@ WhiteSpaceOptions_for='for' WhiteSpaceOptions_if='if' WhiteSpaceOptions_switch='switch' WhiteSpaceOptions_while='while' -WhiteSpaceOptions_member_function_declaration=Member function declaration -#WhiteSpaceOptions_constructor=Constructor -WhiteSpaceOptions_method=Method -WhiteSpaceOptions_method_call=Method call +WhiteSpaceOptions_function_declaration=Function declaration +WhiteSpaceOptions_function=Function +WhiteSpaceOptions_exception_specification=Exception specification +WhiteSpaceOptions_function_call=Function call WhiteSpaceOptions_paren_expr=Parenthesized expression WhiteSpaceOptions_type_cast=Type cast -#WhiteSpaceOptions_parameterized_type=Parameterized type WhiteSpaceOptions_template_arguments=Template arguments WhiteSpaceOptions_template_parameters=Template parameters -#WhiteSpaceOptions_vararg_parameter=Vararg parameters WhiteSpaceOptions_closing_paren=Closing parenthesis @@ -176,8 +165,6 @@ WhiteSpaceOptions_arguments=Arguments #WhiteSpaceOptions_incrementation=Increment WhiteSpaceOptions_parameters=Parameters -#WhiteSpaceOptions_alloc_expr=Allocation expression -#WhiteSpaceOptions_throws='throws' clause WhiteSpaceOptions_lists=Lists WhiteSpaceOptions_expression_list=Expression list WhiteSpaceOptions_declarator_list=Declarator list @@ -193,8 +180,7 @@ WhiteSpaceOptions_question_mark=Question mark WhiteSpaceOptions_between_empty_parens=Between empty parenthesis WhiteSpaceOptions_between_empty_braces=Between empty braces WhiteSpaceOptions_between_empty_brackets=Between empty brackets -#WhiteSpaceOptions_constructor_decl=Constructor declaration -WhiteSpaceOptions_method_decl=Method declaration +WhiteSpaceOptions_function_decl=Function declaration WhiteSpaceOptions_case='case' WhiteSpaceOptions_default='default' WhiteSpaceOptions_statements=Statements @@ -251,8 +237,7 @@ LineWrappingTabPage_indentation_default=Default indentation LineWrappingTabPage_indentation_on_column=Indent on column LineWrappingTabPage_indentation_by_one=Indent by one LineWrappingTabPage_class_decls=Class declarations -LineWrappingTabPage_method_decls=Function declarations -#LineWrappingTabPage_constructor_decls=Constructor declarations +LineWrappingTabPage_function_decls=Function declarations LineWrappingTabPage_function_calls=Function calls LineWrappingTabPage_expressions=Expressions #LineWrappingTabPage_statements=Statements @@ -273,8 +258,7 @@ LineWrappingTabPage_indentation_default_lowercase=default indentation LineWrappingTabPage_indentation_on_column_lowercase=indent on column LineWrappingTabPage_indentation_by_one_lowercase=indent by one LineWrappingTabPage_class_decls_lowercase=class declarations -LineWrappingTabPage_method_decls_lowercase=function declarations -#LineWrappingTabPage_constructor_decls_lowercase=constructor declarations +LineWrappingTabPage_function_decls_lowercase=function declarations LineWrappingTabPage_function_calls_lowercase=function calls LineWrappingTabPage_expressions_lowercase=expressions #LineWrappingTabPage_statements_lowercase=statements @@ -339,8 +323,7 @@ BracesTabPage_position_next_line_on_wrap=Next line on wrap BracesTabPage_group_brace_positions_title=Brace positions BracesTabPage_option_class_declaration=&Class declaration: BracesTabPage_option_namespace_declaration=&Namespace declaration: -BracesTabPage_option_method_declaration=Met&hod declaration: -#BracesTabPage_option_constructor_declaration=Constr&uctor declaration: +BracesTabPage_option_function_declaration=&Function declaration: BracesTabPage_option_blocks=&Blocks: BracesTabPage_option_blocks_in_case=Bloc&ks in case statement: BracesTabPage_option_switch_case='&switch' statement: @@ -423,7 +406,7 @@ IndentationTabPage_indent_group_title=Indent IndentationTabPage_class_group_option_indent_access_specifiers_within_class_body='public', 'protected', 'private' within class &body IndentationTabPage_class_group_option_indent_declarations_compare_to_access_specifiers=De&clarations relative to 'public', 'protected', 'private' -IndentationTabPage_block_group_option_indent_statements_compare_to_body=Stat&ements within method/constructor body +IndentationTabPage_block_group_option_indent_statements_compare_to_body=Stat&ements within function body IndentationTabPage_block_group_option_indent_statements_compare_to_block=Statements within bl&ocks IndentationTabPage_namespace_group_option_indent_declarations_within_namespace=Declarations within '&namespace' definition IndentationTabPage_indent_empty_lines=Empty lines diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java index 878b135c5a9..c1eff50de80 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/LineWrappingTabPage.java @@ -583,7 +583,7 @@ public class LineWrappingTabPage extends FormatterTabPage { // constructorDeclarations.children.add(fConstructorDeclarationsParametersCategory); // constructorDeclarations.children.add(fConstructorThrowsClauseCategory); - final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_method_decls,FormatterMessages.LineWrappingTabPage_method_decls_lowercase); + final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_function_decls,FormatterMessages.LineWrappingTabPage_function_decls_lowercase); methodDeclarations.children.add(fMethodDeclarationsParametersCategory); methodDeclarations.children.add(fMethodThrowsClauseCategory); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java index f2bc410aa47..4014ffdbfa9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java @@ -184,7 +184,7 @@ public final class WhiteSpaceOptions { private final PreviewSnippet METHOD_DECL_PREVIEW= new PreviewSnippet( CodeFormatter.K_CLASS_BODY_DECLARATIONS, "void foo() throw(E0, E1) {}" + //$NON-NLS-1$ - "void bar(int x, int y) throw(E0, E1) {}"); //$NON-NLS-1$ + "void bar(int x, int y) throw() {}"); //$NON-NLS-1$ private final PreviewSnippet INITIALIZER_LIST_PREVIEW= new PreviewSnippet( CodeFormatter.K_STATEMENTS, @@ -439,13 +439,14 @@ public final class WhiteSpaceOptions { return parent; } - public ArrayListcreateTreeByJavaElement(Map workingValues) { + public ArrayList createTreeByCElement(Map workingValues) { final InnerNode declarations= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_declarations); createClassTree(workingValues, declarations); createDeclaratorListTree(workingValues, declarations); // createConstructorTree(workingValues, declarations); createMethodDeclTree(workingValues, declarations); + createExceptionSpecificationTree(workingValues, declarations); createLabelTree(workingValues, declarations); final InnerNode statements= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_statements); @@ -511,24 +512,19 @@ public final class WhiteSpaceOptions { // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_incrementation, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW); final InnerNode invocation= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arguments); - createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); -// createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_alloc_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW); + createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); + createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW); final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameters); -// createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW); - createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW); -// final InnerNode throwsDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throws); -// createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW); -// createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); - final InnerNode lists= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_lists); createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_declarator_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW); createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_expression_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW); createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); } private void createBeforeOperatorTree(Map workingValues, final InnerNode parent) { @@ -566,9 +562,8 @@ public final class WhiteSpaceOptions { createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_class_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, CLASS_DECL_PREVIEW); - final InnerNode functionDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration); { -// createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); - createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + final InnerNode functionDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); { + createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); } createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW); @@ -586,11 +581,11 @@ public final class WhiteSpaceOptions { createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, CAST_PREVIEW); - final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration); -// createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); - createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW); } @@ -604,11 +599,11 @@ public final class WhiteSpaceOptions { // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_return_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, RETURN_PREVIEW); // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throw_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, THROW_PREVIEW); - final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration); -// createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); - createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); + createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW); } @@ -641,25 +636,20 @@ public final class WhiteSpaceOptions { // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_incrementation, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW); // } final InnerNode invocation= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arguments); { - createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); -// createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_alloc_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW); + createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); + createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW); } final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameters); { -// createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW); - createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); + createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW); } -// final InnerNode throwsDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throws); { -// createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW); -// createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); -// } final InnerNode lists= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_lists); { createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_declarator_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW); createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_expression_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW); createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW); } - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); } private void createAfterOperatorTree(Map workingValues, final InnerNode parent) { @@ -709,20 +699,20 @@ public final class WhiteSpaceOptions { createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW); createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW); - final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration); { -// createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); - createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); { + createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); } createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST, CAST_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW); } private void createBetweenEmptyParenTree(Map workingValues, final InnerNode parent) { -// createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_constructor_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); - createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); + createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION, METHOD_CALL_PREVIEW); } private void createBetweenEmptyBracketsTree(Map workingValues, final InnerNode parent) { @@ -767,7 +757,7 @@ public final class WhiteSpaceOptions { } private InnerNode createMethodDeclTree(Map workingValues, InnerNode parent) { - final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_methods); + final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_functions); createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW); @@ -777,30 +767,22 @@ public final class WhiteSpaceOptions { createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_ellipsis, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, VARARG_PARAMETER_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_ellipsis, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, VARARG_PARAMETER_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_throws, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_throws, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); - return root; } - -// private InnerNode createConstructorTree(Map workingValues, InnerNode parent) { -// final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_constructors); -// -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW); -// -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_throws, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW); -// createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_throws, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW); -// return root; -// } - + + private InnerNode createExceptionSpecificationTree(Map workingValues, InnerNode parent) { + final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_exception_specifications); + + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW); + + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); + return root; + } + private InnerNode createDeclaratorListTree(Map workingValues, InnerNode parent) { final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list); @@ -843,8 +825,8 @@ public final class WhiteSpaceOptions { createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW); - createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_before_comma_in_method_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); - createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_after_comma_in_method_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_before_comma_in_function_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); + createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_after_comma_in_function_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_before_comma_in_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW); // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_after_comma_in_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW); return root; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java index 02a2187a60a..ff3c5e06c1f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/WhiteSpaceTabPage.java @@ -181,10 +181,10 @@ public class WhiteSpaceTabPage extends FormatterTabPage { - private final class JavaElementComponent implements ISelectionChangedListener, ICheckStateListener { + private final class CElementComponent implements ISelectionChangedListener, ICheckStateListener { - private final String PREF_INNER_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.white_space.java_view.inner"; //$NON-NLS-1$ - private final String PREF_OPTION_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.white_space.java_view.option"; //$NON-NLS-1$ + private final String PREF_INNER_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.white_space.c_view.inner"; //$NON-NLS-1$ + private final String PREF_OPTION_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.white_space.c_view.option"; //$NON-NLS-1$ private final ArrayList fIndexedNodeList; private final ArrayList fTree; @@ -196,9 +196,9 @@ public class WhiteSpaceTabPage extends FormatterTabPage { private Composite fComposite; - public JavaElementComponent() { + public CElementComponent() { fIndexedNodeList= new ArrayList (); - fTree= new WhiteSpaceOptions().createTreeByJavaElement(fWorkingValues); + fTree= new WhiteSpaceOptions().createTreeByCElement(fWorkingValues); WhiteSpaceOptions.makeIndexForNodes(fTree, fIndexedNodeList); } @@ -377,11 +377,11 @@ public class WhiteSpaceTabPage extends FormatterTabPage { private Combo fSwitchCombo; private PageBook fPageBook; private final SyntaxComponent fSyntaxComponent; - private final JavaElementComponent fJavaElementComponent; + private final CElementComponent fCElementComponent; public SwitchComponent() { fSyntaxComponent= new SyntaxComponent(); - fJavaElementComponent= new JavaElementComponent(); + fCElementComponent= new CElementComponent(); } @Override @@ -389,8 +389,8 @@ public class WhiteSpaceTabPage extends FormatterTabPage { final int index= fSwitchCombo.getSelectionIndex(); if (index == 0) { fDialogSettings.put(PREF_VIEW_KEY, false); - fJavaElementComponent.refreshState(); - fPageBook.showPage(fJavaElementComponent.getControl()); + fCElementComponent.refreshState(); + fPageBook.showPage(fCElementComponent.getControl()); } else if (index == 1) { fDialogSettings.put(PREF_VIEW_KEY, true); @@ -404,7 +404,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { fPageBook= new PageBook(parent, SWT.NONE); fPageBook.setLayoutData(createGridData(numColumns, GridData.FILL_BOTH, SWT.DEFAULT)); - fJavaElementComponent.createContents(numColumns, fPageBook); + fCElementComponent.createContents(numColumns, fPageBook); fSyntaxComponent.createContents(numColumns, fPageBook); fSwitchCombo= new Combo(parent, SWT.READ_ONLY); @@ -415,7 +415,7 @@ public class WhiteSpaceTabPage extends FormatterTabPage { public void initialize() { fSwitchCombo.addSelectionListener(this); - fJavaElementComponent.initialize(); + fCElementComponent.initialize(); fSyntaxComponent.initialize(); restoreSelection(); } @@ -427,9 +427,9 @@ public class WhiteSpaceTabPage extends FormatterTabPage { fSwitchCombo.setText(fItems[1]); fPageBook.showPage(fSyntaxComponent.getControl()); } else { - fJavaElementComponent.refreshState(); + fCElementComponent.refreshState(); fSwitchCombo.setText(fItems[0]); - fPageBook.showPage(fJavaElementComponent.getControl()); + fPageBook.showPage(fCElementComponent.getControl()); } } }