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 c80436559cf..5f9d2cdfc3d 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 @@ -232,6 +232,17 @@ public class DefaultCodeFormatterConstants { * @see #createAlignmentValue(boolean, int, int) */ public static final String FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_base_clause_in_type_declaration"; //$NON-NLS-1$ + /** + *
+ * FORMATTER / Option for alignment of constructor initializer list
+ * - option id: "org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list"
+ * - possible values: values returned by createAlignmentValue(boolean, int, int)
call
+ * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
+ *
+ * @see #createAlignmentValue(boolean, int, int)
+ * @since 5.3
+ */
+ public static final String FORMATTER_ALIGNMENT_FOR_CONSTRUCTOR_INITIALIZER_LIST = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_constructor_initializer_list"; //$NON-NLS-1$
/**
* * FORMATTER / Option for alignment of throws clause in method declaration @@ -242,7 +253,6 @@ public class DefaultCodeFormatterConstants { * @see #createAlignmentValue(boolean, int, int) */ public static final String FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_throws_clause_in_method_declaration"; //$NON-NLS-1$ -// // /** // *// * FORMATTER / Option to add blank lines after #include directive @@ -717,6 +727,18 @@ public class DefaultCodeFormatterConstants { * @see CCorePlugin#DO_NOT_INSERT */ public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_INITIALIZER_LIST = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_closing_brace_in_array_initializer";//$NON-NLS-1$ + /** + *+ * FORMATTER / Option to insert a new line before colon in constructor initializer list. + * - option id: "org.eclipse.cdt.core.formatter.formatter.insert_new_line_before_colon_in_constructor_initializer_list" + * - possible values: { DO_NOT_INSERT, INSERT } + * - default: DO_NOT_INSERT + *+ * @see CCorePlugin#INSERT + * @see CCorePlugin#DO_NOT_INSERT + * @since 5.3 + */ + public static final String FORMATTER_INSERT_NEW_LINE_BEFORE_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST = CCorePlugin.PLUGIN_ID + ".formatter.insert_new_line_before_colon_in_constructor_initializer_list"; //$NON-NLS-1$ /** ** FORMATTER / Option to insert a new line before the else keyword in if statement 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 1ddfb8b1005..7bdf331271a 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 @@ -1012,12 +1012,20 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, if (node instanceof ICPPASTFunctionDefinition) { final ICPPASTConstructorChainInitializer[] constructorChain= ((ICPPASTFunctionDefinition) node).getMemberInitializers(); if (constructorChain != null && constructorChain.length > 0) { - // TLETODO [formatter] need special constructor chain alignment - scribe.printNextToken(Token.tCOLON, true); - scribe.printTrailingComment(); - scribe.startNewLine(); - scribe.indent(); - final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT); + if (preferences.insert_new_line_before_colon_in_constructor_initializer_list) { + scribe.printTrailingComment(); + scribe.startNewLine(); + scribe.indent(); + } + scribe.printNextToken(Token.tCOLON, !preferences.insert_new_line_before_colon_in_constructor_initializer_list); + if (preferences.insert_new_line_before_colon_in_constructor_initializer_list) { + scribe.space(); + } else { + scribe.printTrailingComment(); + scribe.startNewLine(); + scribe.indent(); + } + final ListAlignment align= new ListAlignment(preferences.alignment_for_constructor_initializer_list); align.fTieBreakRule = Alignment.R_OUTERMOST; formatList(Arrays.asList(constructorChain), align, false, false); scribe.unIndent(); @@ -1162,7 +1170,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, if (pointer instanceof ICPPASTReferenceOperator) { scribe.printNextToken(Token.tAMPER, false); } else if (pointer instanceof ICPPASTPointerToMember) { - final ICPPASTPointerToMember ptrToMember= (ICPPASTPointerToMember)pointer; + final ICPPASTPointerToMember ptrToMember= (ICPPASTPointerToMember) pointer; final IASTName name= ptrToMember.getName(); if (name != null) { name.accept(this); @@ -1226,7 +1234,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, } } if (arrayModifier instanceof ICASTArrayModifier) { - final ICASTArrayModifier cArrayModifier= (ICASTArrayModifier)arrayModifier; + final ICASTArrayModifier cArrayModifier= (ICASTArrayModifier) arrayModifier; if (scribe.printModifiers()) { scribe.space(); } @@ -2920,7 +2928,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, IASTStatement bodyStmt= node.getBody(); final Liststatements; if (bodyStmt instanceof IASTCompoundStatement) { - statements= Arrays.asList(((IASTCompoundStatement)bodyStmt).getStatements()); + statements= Arrays.asList(((IASTCompoundStatement) bodyStmt).getStatements()); } else { statements= Collections.singletonList(bodyStmt); } @@ -3565,7 +3573,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, continue; } if (statement instanceof IASTPreprocessorIfStatement) { - IASTPreprocessorIfStatement ifStmt = (IASTPreprocessorIfStatement)statement; + IASTPreprocessorIfStatement ifStmt = (IASTPreprocessorIfStatement) statement; inactiveCodeStack.push(Boolean.valueOf(inInactiveCode)); if (!ifStmt.taken()) { if (!inInactiveCode) { @@ -3574,7 +3582,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, } } } else if (statement instanceof IASTPreprocessorIfdefStatement) { - IASTPreprocessorIfdefStatement ifdefStmt = (IASTPreprocessorIfdefStatement)statement; + IASTPreprocessorIfdefStatement ifdefStmt = (IASTPreprocessorIfdefStatement) statement; inactiveCodeStack.push(Boolean.valueOf(inInactiveCode)); if (!ifdefStmt.taken()) { if (!inInactiveCode) { @@ -3583,7 +3591,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, } } } else if (statement instanceof IASTPreprocessorIfndefStatement) { - IASTPreprocessorIfndefStatement ifndefStmt = (IASTPreprocessorIfndefStatement)statement; + IASTPreprocessorIfndefStatement ifndefStmt = (IASTPreprocessorIfndefStatement) statement; inactiveCodeStack.push(Boolean.valueOf(inInactiveCode)); if (!ifndefStmt.taken()) { if (!inInactiveCode) { @@ -3592,7 +3600,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, } } } else if (statement instanceof IASTPreprocessorElseStatement) { - IASTPreprocessorElseStatement elseStmt = (IASTPreprocessorElseStatement)statement; + IASTPreprocessorElseStatement elseStmt = (IASTPreprocessorElseStatement) statement; if (!elseStmt.taken() && !inInactiveCode) { inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); inInactiveCode = true; @@ -3602,7 +3610,7 @@ public class CodeFormatterVisitor extends ASTVisitor implements ICPPASTVisitor, inInactiveCode = false; } } else if (statement instanceof IASTPreprocessorElifStatement) { - IASTPreprocessorElifStatement elifStmt = (IASTPreprocessorElifStatement)statement; + IASTPreprocessorElifStatement elifStmt = (IASTPreprocessorElifStatement) statement; if (!elifStmt.taken() && !inInactiveCode) { inactiveCodeStart = nodeLocation.getNodeOffset() + nodeLocation.getNodeLength(); inInactiveCode = true; 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 cfac91aefe7..9e3f6859538 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 @@ -68,9 +68,10 @@ public class DefaultCodeFormatterOptions { public int alignment_for_member_access; public int alignment_for_parameters_in_method_declaration; public int alignment_for_throws_clause_in_method_declaration; - + public int alignment_for_constructor_initializer_list; + // public boolean align_type_members_on_columns; - + public String brace_position_for_block; public String brace_position_for_block_in_case; // public String brace_position_for_enum_declaration; @@ -79,10 +80,10 @@ public class DefaultCodeFormatterOptions { public String brace_position_for_namespace_declaration; public String brace_position_for_switch; public String brace_position_for_type_declaration; - + public int continuation_indentation; public int continuation_indentation_for_initializer_list; - + // public int blank_lines_after_includes; // public int blank_lines_before_field; // public int blank_lines_before_first_class_body_declaration; @@ -118,6 +119,7 @@ public class DefaultCodeFormatterOptions { public boolean insert_new_line_at_end_of_file_if_missing; public boolean insert_new_line_before_catch_in_try_statement; public boolean insert_new_line_before_closing_brace_in_initializer_list; + public boolean insert_new_line_before_colon_in_constructor_initializer_list; public boolean insert_new_line_before_else_in_if_statement; public boolean insert_new_line_before_while_in_do_statement; public boolean insert_new_line_before_identifier_in_function_declaration; @@ -278,6 +280,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_parameters_in_method_declaration)); // options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_selector_in_method_invocation)); options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_base_clause_in_type_declaration)); + options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONSTRUCTOR_INITIALIZER_LIST, getAlignment(this.alignment_for_constructor_initializer_list)); options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration)); // options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE); options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_INITIALIZER_LIST, this.brace_position_for_initializer_list); @@ -322,6 +325,7 @@ public class DefaultCodeFormatterOptions { options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, this.insert_new_line_at_end_of_file_if_missing ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CATCH_IN_TRY_STATEMENT, this.insert_new_line_before_catch_in_try_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_INITIALIZER_LIST, this.insert_new_line_before_closing_brace_in_initializer_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); + options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST, this.insert_new_line_before_colon_in_constructor_initializer_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT, this.insert_new_line_before_else_in_if_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_WHILE_IN_DO_STATEMENT, this.insert_new_line_before_while_in_do_statement? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_IDENTIFIER_IN_FUNCTION_DECLARATION, this.insert_new_line_before_identifier_in_function_declaration? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT); @@ -593,6 +597,16 @@ public class DefaultCodeFormatterOptions { this.alignment_for_base_clause_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT; } } + final Object alignmentForConstructorInitializerListOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONSTRUCTOR_INITIALIZER_LIST); + if (alignmentForConstructorInitializerListOption != null) { + try { + this.alignment_for_constructor_initializer_list = Integer.parseInt((String) alignmentForConstructorInitializerListOption); + } catch (NumberFormatException e) { + this.alignment_for_constructor_initializer_list = Alignment.M_COMPACT_SPLIT; + } catch (ClassCastException e) { + this.alignment_for_constructor_initializer_list = Alignment.M_COMPACT_SPLIT; + } + } final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION); if (alignmentForThrowsClauseInMethodDeclarationOption != null) { try { @@ -891,6 +905,10 @@ public class DefaultCodeFormatterOptions { if (insertNewLineBeforeClosingBraceInInitializerListOption != null) { this.insert_new_line_before_closing_brace_in_initializer_list = CCorePlugin.INSERT.equals(insertNewLineBeforeClosingBraceInInitializerListOption); } + final Object insertNewLineBeforeColonInConstructorInitializerListOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST); + if (insertNewLineBeforeColonInConstructorInitializerListOption != null) { + this.insert_new_line_before_colon_in_constructor_initializer_list = CCorePlugin.INSERT.equals(insertNewLineBeforeColonInConstructorInitializerListOption); + } final Object insertNewLineBeforeElseInIfStatementOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_ELSE_IN_IF_STATEMENT); if (insertNewLineBeforeElseInIfStatementOption != null) { this.insert_new_line_before_else_in_if_statement = CCorePlugin.INSERT.equals(insertNewLineBeforeElseInIfStatementOption); diff --git a/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp b/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp index 5f3218737d1..6b105eb5244 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/formatter/complex/After.cpp @@ -16,7 +16,7 @@ public: // comment Complex(float re, float im) : // comment - re(re), im(im) { + re(re), im(im) { } // comment float GetRe() { 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 b2442b283cf..e513177c290 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 @@ -1108,6 +1108,59 @@ public class CodeFormatterTest extends BaseUITestCase { assertFormatterResult(); } + //class Point { + //public: + //Point(int x, int y) : x(x), y(y) {} + // + //private: + //int x; + //int y; + //}; + + //class Point { + //public: + // Point(int x, int y) : + // x(x), y(y) { + // } + // + //private: + // int x; + // int y; + //}; + public void testConstructorInitializer_1() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); + assertFormatterResult(); + } + + //class Point { + //public: + //Point(int x, int y) : x(x), y(y) {} + // + //private: + //int x; + //int y; + //}; + + //class Point { + //public: + // Point(int x, int y) + // : x(x), + // y(y) { + // } + // + //private: + // int x; + // int y; + //}; + public void testConstructorInitializer_2() throws Exception { + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR, CCorePlugin.SPACE); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST, + CCorePlugin.INSERT); + fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONSTRUCTOR_INITIALIZER_LIST, + Integer.toString(Alignment.M_NEXT_PER_LINE_SPLIT | Alignment.M_INDENT_ON_COLUMN | Alignment.M_FORCE)); + assertFormatterResult(); + } + //#define A (0) //#define B (1) //#define ARGS (A, B) 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 186b9c130fc..5bdbf4196b8 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 @@ -41,7 +41,7 @@ public class BracesTabPage extends FormatterTabPage { "\n\n" + //$NON-NLS-1$ "class Point {" + //$NON-NLS-1$ "public:" + //$NON-NLS-1$ - "Point(double xc, double yc) : x(xc), y(yc) {}" + //$NON-NLS-1$ + "Point(double x, double y) : x(x), y(y) {}" + //$NON-NLS-1$ "double distance(const Point& other) const;" + //$NON-NLS-1$ "int compareX(const Point& other) const;" + //$NON-NLS-1$ "double x;" + //$NON-NLS-1$ @@ -80,10 +80,8 @@ public class BracesTabPage extends FormatterTabPage { "}"+ //$NON-NLS-1$ "} // end namespace FOO"; //$NON-NLS-1$ - private TranslationUnitPreview fPreview; - private final String [] fBracePositions= { DefaultCodeFormatterConstants.END_OF_LINE, DefaultCodeFormatterConstants.NEXT_LINE, @@ -109,20 +107,18 @@ public class BracesTabPage extends FormatterTabPage { FormatterMessages.BracesTabPage_position_next_line_indented, FormatterMessages.BracesTabPage_position_next_line_on_wrap }; - /** * Create a new BracesTabPage. * @param modifyDialog * @param workingValues */ - public BracesTabPage(ModifyDialog modifyDialog, Map workingValues) { + public BracesTabPage(ModifyDialog modifyDialog, Map workingValues) { super(modifyDialog, workingValues); } @Override protected void doCreatePreferences(Composite composite, int numColumns) { - final Group group= createGroup(numColumns, composite, FormatterMessages.BracesTabPage_group_brace_positions_title); 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); @@ -179,11 +175,9 @@ public class BracesTabPage extends FormatterTabPage { data.horizontalIndent= fPixelConverter.convertWidthInCharsToPixels(1); return pref; } - @Override protected void doUpdatePreview() { fPreview.update(); } - } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java index 3de161ffd42..7349e8ee4f5 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/CodeFormatterConfigurationBlock.java @@ -74,7 +74,7 @@ public class CodeFormatterConfigurationBlock extends ProfileConfigurationBlock { "#include \n\n" + //$NON-NLS-1$ "class Point {" + //$NON-NLS-1$ "public:" + //$NON-NLS-1$ - "Point(double xc, double yc) : x(xc), y(yc) {}" + //$NON-NLS-1$ + "Point(double x, double y) : x(x), y(y) {}" + //$NON-NLS-1$ "double distance(const Point& other) const;" + //$NON-NLS-1$ "\n\n" + //$NON-NLS-1$ "double x;" + //$NON-NLS-1$ 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 cd1f2195531..60c975508d3 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 @@ -201,6 +201,7 @@ final class FormatterMessages extends NLS { public static String LineWrappingTabPage_parameters; public static String LineWrappingTabPage_arguments; public static String LineWrappingTabPage_throws_clause; + public static String LineWrappingTabPage_constructor_initializer_list; public static String LineWrappingTabPage_enum_decls; public static String LineWrappingTabPage_enumerator_list; public static String LineWrappingTabPage_initializer_list; @@ -222,6 +223,7 @@ final class FormatterMessages extends NLS { public static String LineWrappingTabPage_parameters_lowercase; public static String LineWrappingTabPage_arguments_lowercase; public static String LineWrappingTabPage_throws_clause_lowercase; + public static String LineWrappingTabPage_constructor_initializer_list_lowercase; public static String LineWrappingTabPage_enum_decls_lowercase; public static String LineWrappingTabPage_enumerator_list_lowercase; public static String LineWrappingTabPage_initializer_list_lowercase; @@ -375,7 +377,7 @@ final class FormatterMessages extends NLS { public static String ModifyDialog_tabpage_indentation_title; public static String ModifyDialog_tabpage_whitespace_title; // public static String ModifyDialog_tabpage_blank_lines_title; -// public static String ModifyDialog_tabpage_new_lines_title; + public static String ModifyDialog_tabpage_new_lines_title; public static String ModifyDialog_tabpage_control_statements_title; public static String ModifyDialog_tabpage_line_wrapping_title; // public static String ModifyDialog_tabpage_comments_title; @@ -384,8 +386,9 @@ final class FormatterMessages extends NLS { public static String ModifyDialogTabPage_error_msg_values_items_text_unassigned; public static String ModifyDialogTabPage_NumberPreference_error_invalid_key; public static String ModifyDialogTabPage_NumberPreference_error_invalid_value; -// public static String NewLinesTabPage_preview_header; -// public static String NewLinesTabPage_newlines_group_title; + public static String NewLinesTabPage_preview_header; + public static String NewLinesTabPage_newlines_group_title; + public static String NewLinesTabPage_newlines_group_option_before_colon_in_constructor_initializer_list; // public static String NewLinesTabPage_newlines_group_option_empty_class_body; // public static String NewLinesTabPage_newlines_group_option_empty_method_body; // public static String NewLinesTabPage_newlines_group_option_empty_block; 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 bc6e983754d..8bcca30d856 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 @@ -226,6 +226,7 @@ LineWrappingTabPage_base_clause=Base-clause LineWrappingTabPage_parameters=Parameters LineWrappingTabPage_arguments=Arguments LineWrappingTabPage_throws_clause=Exception specification +LineWrappingTabPage_constructor_initializer_list=Constructor initializer list #LineWrappingTabPage_object_allocation=Object allocation arguments LineWrappingTabPage_enum_decls='enum' declaration LineWrappingTabPage_enumerator_list=Enumerator list @@ -249,6 +250,7 @@ LineWrappingTabPage_base_clause_lowercase=base-clause LineWrappingTabPage_parameters_lowercase=parameters LineWrappingTabPage_arguments_lowercase=arguments LineWrappingTabPage_throws_clause_lowercase=exception specification +LineWrappingTabPage_constructor_initializer_list_lowercase=constructor initializer list #LineWrappingTabPage_object_allocation_lowercase=object allocation arguments LineWrappingTabPage_enum_decls_lowercase='enum' declaration LineWrappingTabPage_enumerator_list_lowercase=enumerator list @@ -426,7 +428,7 @@ ModifyDialog_NewCreated_Status=A new profile will be created. ModifyDialog_tabpage_indentation_title=In&dentation ModifyDialog_tabpage_whitespace_title=&White Space #ModifyDialog_tabpage_blank_lines_title=Bla&nk Lines -#ModifyDialog_tabpage_new_lines_title=New &Lines +ModifyDialog_tabpage_new_lines_title=New &Lines ModifyDialog_tabpage_control_statements_title=Con&trol Statements ModifyDialog_tabpage_line_wrapping_title=Line Wra&pping #ModifyDialog_tabpage_comments_title=Co&mments @@ -445,9 +447,10 @@ ModifyDialogTabPage_error_msg_values_items_text_unassigned=Values, items and tex ModifyDialogTabPage_NumberPreference_error_invalid_key=The key {0} does not yield a valid integer value. ModifyDialogTabPage_NumberPreference_error_invalid_value=Invalid value: Please enter a number between {0} and {1}. -#NewLinesTabPage_preview_header=New Lines -#NewLinesTabPage_newlines_group_title=Insert new line +NewLinesTabPage_preview_header=New lines +NewLinesTabPage_newlines_group_title=Insert new line +NewLinesTabPage_newlines_group_option_before_colon_in_constructor_initializer_list=before colon in constructor initializer list #NewLinesTabPage_newlines_group_option_empty_class_body=in empty &class body #NewLinesTabPage_newlines_group_option_empty_method_body=in empt&y method body #NewLinesTabPage_newlines_group_option_empty_block=in empty &block diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterModifyDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterModifyDialog.java index e3ef25767af..aaa10ad0991 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterModifyDialog.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterModifyDialog.java @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Anton Leherbauer (Wind River Systems) + * Sergey Prigogin (Google) *******************************************************************************/ package org.eclipse.cdt.internal.ui.preferences.formatter; @@ -29,10 +30,9 @@ public class FormatterModifyDialog extends ModifyDialog { addTabPage(FormatterMessages.ModifyDialog_tabpage_braces_title, new BracesTabPage(this, values)); addTabPage(FormatterMessages.ModifyDialog_tabpage_whitespace_title, new WhiteSpaceTabPage(this, values)); // addTabPage(FormatterMessages.ModifyDialog_tabpage_blank_lines_title, new BlankLinesTabPage(this, values)); -// addTabPage(FormatterMessages.ModifyDialog_tabpage_new_lines_title, new NewLinesTabPage(this, values)); + addTabPage(FormatterMessages.ModifyDialog_tabpage_new_lines_title, new NewLinesTabPage(this, values)); addTabPage(FormatterMessages.ModifyDialog_tabpage_control_statements_title, new ControlStatementsTabPage(this, values)); addTabPage(FormatterMessages.ModifyDialog_tabpage_line_wrapping_title, new LineWrappingTabPage(this, values)); // addTabPage(FormatterMessages.ModifyDialog_tabpage_comments_title, new CommentsTabPage(this, values)); } - } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterTabPage.java index 5c8e3eda754..e95aff90101 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterTabPage.java @@ -21,11 +21,11 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; +import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; import org.eclipse.cdt.ui.CUIPlugin; public abstract class FormatterTabPage extends ModifyDialogTabPage { - private final static String SHOW_INVISIBLE_PREFERENCE_KEY= CUIPlugin.PLUGIN_ID + ".formatter_page.show_invisible_characters"; //$NON-NLS-1$ /** @@ -35,6 +35,11 @@ public abstract class FormatterTabPage extends ModifyDialogTabPage { */ protected static String[] TRUE_FALSE= { DefaultCodeFormatterConstants.TRUE, DefaultCodeFormatterConstants.FALSE }; + /** + * Constant array for insert / not_insert. + */ + protected static String[] DO_NOT_INSERT_INSERT= { CCorePlugin.DO_NOT_INSERT, CCorePlugin.INSERT }; + private CPreview fPreview; private final IDialogSettings fDialogSettings; private Button fShowInvisibleButton; @@ -47,7 +52,6 @@ public abstract class FormatterTabPage extends ModifyDialogTabPage { @Override protected Composite doCreatePreviewPane(Composite composite, int numColumns) { - createLabel(numColumns - 1, composite, FormatterMessages.ModifyDialogTabPage_preview_label_text); fShowInvisibleButton= new Button(composite, SWT.CHECK); @@ -85,5 +89,4 @@ public abstract class FormatterTabPage extends ModifyDialogTabPage { fPreview.showInvisibleCharacters(showInvisible); fShowInvisibleButton.setSelection(showInvisible); } - } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/IndentationTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/IndentationTabPage.java index c8d40e1eebf..28735009d1b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/IndentationTabPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/IndentationTabPage.java @@ -43,7 +43,7 @@ public class IndentationTabPage extends FormatterTabPage { "#include \n\n" + //$NON-NLS-1$ "class Point {" + //$NON-NLS-1$ "public:" + //$NON-NLS-1$ - "Point(double xc, double yc) : x(xc), y(yc) {}" + //$NON-NLS-1$ + "Point(double x, double y) : x(x), y(y) {}" + //$NON-NLS-1$ "\n\n" + //$NON-NLS-1$ "double distance(const Point& other) const;" + //$NON-NLS-1$ "int compareX(const Point& other) const;" + //$NON-NLS-1$ 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 9bfb1b455ca..cd44ac88bed 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 @@ -90,11 +90,8 @@ public class LineWrappingTabPage extends FormatterTabPage { private final static String PREF_CATEGORY_INDEX= CUIPlugin.PLUGIN_ID + "formatter_page.line_wrapping_tab_page.last_category_index"; //$NON-NLS-1$ - private final class CategoryListener implements ISelectionChangedListener, IDoubleClickListener { - private final List fCategoriesList; - private int fIndex= 0; public CategoryListener(List categoriesTree) { @@ -404,6 +401,20 @@ public class LineWrappingTabPage extends FormatterTabPage { FormatterMessages.LineWrappingTabPage_throws_clause_lowercase ); + private final Category fConstructorInitializerListCategory= new Category( + DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONSTRUCTOR_INITIALIZER_LIST, + "class Point {" + //$NON-NLS-1$ + "public:" + //$NON-NLS-1$ + "Point(double x, double y) : x(x), y(y) {" + //$NON-NLS-1$ + "}\n\n" + //$NON-NLS-1$ + "private:" + //$NON-NLS-1$ + "double x;" + //$NON-NLS-1$ + "double y;" + //$NON-NLS-1$ + "};", //$NON-NLS-1$ + FormatterMessages.LineWrappingTabPage_constructor_initializer_list, + FormatterMessages.LineWrappingTabPage_constructor_initializer_list_lowercase + ); + // private final Category fConstructorThrowsClauseCategory= new Category( // DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION, // "class Example {" + //$NON-NLS-1$ @@ -412,8 +423,7 @@ public class LineWrappingTabPage extends FormatterTabPage { // FormatterMessages.LineWrappingTabPage_throws_clause // FormatterMessages.LineWrappingTabPage_throws_clause_lowercase // ); -// -// + // private final Category fAllocationExpressionArgumentsCategory= new Category( // DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ALLOCATION_EXPRESSION, // "class Example {SomeClass foo() {return new SomeClass(100, 200, 300, 400, 500, 600, 700, 800, 900 );}}", //$NON-NLS-1$ @@ -475,7 +485,7 @@ public class LineWrappingTabPage extends FormatterTabPage { // FormatterMessages.LineWrappingTabPage_enum_constant_arguments, // FormatterMessages.LineWrappingTabPage_enum_constant_arguments_lowercase // ); -// + // private final Category fEnumDeclInterfacesCategory= new Category( // DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION, // "enum Example implements A, B, C {" + //$NON-NLS-1$ @@ -483,7 +493,7 @@ public class LineWrappingTabPage extends FormatterTabPage { // FormatterMessages.LineWrappingTabPage_enum_superinterfaces, // FormatterMessages.LineWrappingTabPage_enum_superinterfaces_lowercase // ); -// + private final Category fEnumeratorsCategory= new Category( DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ENUMERATOR_LIST, "enum Example {" + //$NON-NLS-1$ @@ -591,10 +601,12 @@ public class LineWrappingTabPage extends FormatterTabPage { // final Category constructorDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_constructor_decls); // constructorDeclarations.children.add(fConstructorDeclarationsParametersCategory); // constructorDeclarations.children.add(fConstructorThrowsClauseCategory); +// constructorDeclarations.children.add(fConstructorInitializerListCategory); final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_function_decls,FormatterMessages.LineWrappingTabPage_function_decls_lowercase); methodDeclarations.children.add(fMethodDeclarationsParametersCategory); methodDeclarations.children.add(fMethodThrowsClauseCategory); + methodDeclarations.children.add(fConstructorInitializerListCategory); final Category enumDeclarations= new Category(FormatterMessages.LineWrappingTabPage_enum_decls,FormatterMessages.LineWrappingTabPage_enum_decls_lowercase); enumDeclarations.children.add(fEnumeratorsCategory); @@ -635,7 +647,6 @@ public class LineWrappingTabPage extends FormatterTabPage { */ @Override protected void doCreatePreferences(Composite composite, int numColumns) { - final Group lineWidthGroup= createGroup(numColumns, composite, FormatterMessages.LineWrappingTabPage_width_indent); createNumberPref(lineWidthGroup, numColumns, FormatterMessages.LineWrappingTabPage_width_indent_option_max_line_width, DefaultCodeFormatterConstants.FORMATTER_LINE_SPLIT, 0, 9999); @@ -692,14 +703,12 @@ public class LineWrappingTabPage extends FormatterTabPage { // selection state object fSelectionState= new SelectionState(); } - /* * @see org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doCreatePreviewPane(org.eclipse.swt.widgets.Composite, int) */ @Override protected Composite doCreatePreviewPane(Composite composite, int numColumns) { - super.doCreatePreviewPane(composite, numColumns); final NumberPreference previewLineWidth= new NumberPreference(composite, numColumns / 2, fPreviewPreferences, LINE_SPLIT, @@ -716,7 +725,6 @@ public class LineWrappingTabPage extends FormatterTabPage { return composite; } - /* * @see org.eclipse.cdt.internal.ui.preferences.formatter.ModifyDialogTabPage#doCreateCPreview(org.eclipse.swt.widgets.Composite) @@ -732,7 +740,6 @@ public class LineWrappingTabPage extends FormatterTabPage { */ @Override protected void initializePage() { - fCategoriesViewer.addSelectionChangedListener(fCategoryListener); fCategoriesViewer.addDoubleClickListener(fCategoryListener); diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/NewLinesTabPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/NewLinesTabPage.java new file mode 100644 index 00000000000..6f169e8a1dc --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/NewLinesTabPage.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.preferences.formatter; + +import java.util.Map; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants; + +public class NewLinesTabPage extends FormatterTabPage { + + private final String PREVIEW= + createPreviewHeader(FormatterMessages.NewLinesTabPage_preview_header) + + "class Point {" + //$NON-NLS-1$ + "public:" + //$NON-NLS-1$ + "Point(double x, double y) : x(x), y(y) {" + //$NON-NLS-1$ + "}\n\n" + //$NON-NLS-1$ + "private:" + //$NON-NLS-1$ + "double x;" + //$NON-NLS-1$ + "double y;" + //$NON-NLS-1$ + "};"; //$NON-NLS-1$ + + protected CheckboxPreference fThenStatementPref; + protected CheckboxPreference fSimpleIfPref; + + private TranslationUnitPreview fPreview; + + public NewLinesTabPage(ModifyDialog modifyDialog, Map workingValues) { + super(modifyDialog, workingValues); + } + + @Override + protected void doCreatePreferences(Composite composite, int numColumns) { + final Group newlinesGroup= createGroup(numColumns, composite, FormatterMessages.NewLinesTabPage_newlines_group_title); + createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_before_colon_in_constructor_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_COLON_IN_CONSTRUCTOR_INITIALIZER_LIST, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_class_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_anonymous_class_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANONYMOUS_TYPE_DECLARATION, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_method_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_label, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_constant, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_annotation_decl_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ANNOTATION_DECLARATION, DO_NOT_INSERT_INSERT); +// createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_end_of_file, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AT_END_OF_FILE_IF_MISSING, DO_NOT_INSERT_INSERT); + +// final Group arrayInitializerGroup= createGroup(numColumns, composite, FormatterMessages.NewLinesTabPage_arrayInitializer_group_title); +// createPref(arrayInitializerGroup, numColumns, FormatterMessages.NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, DO_NOT_INSERT_INSERT); +// createPref(arrayInitializerGroup, numColumns, FormatterMessages.NewLinesTabPage_array_group_option_before_closing_brace_of_array_initializer, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, DO_NOT_INSERT_INSERT); + +// final Group emptyStatementsGroup= createGroup(numColumns, composite, FormatterMessages.NewLinesTabPage_empty_statement_group_title); +// createPref(emptyStatementsGroup, numColumns, FormatterMessages.NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line, DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, FALSE_TRUE); + +// final Group annotationsGroup= createGroup(numColumns, composite, FormatterMessages.NewLinesTabPage_annotations_group_title); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_packages, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PACKAGE, DO_NOT_INSERT_INSERT); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_types, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_TYPE, DO_NOT_INSERT_INSERT); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_fields, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_FIELD, DO_NOT_INSERT_INSERT); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_methods, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_METHOD, DO_NOT_INSERT_INSERT); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_paramters, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_PARAMETER, DO_NOT_INSERT_INSERT); +// createPref(annotationsGroup, numColumns, FormatterMessages.NewLinesTabPage_annotations_group_local_variables, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_ANNOTATION_ON_LOCAL_VARIABLE, DO_NOT_INSERT_INSERT); + } + + @Override + protected void initializePage() { + fPreview.setPreviewText(PREVIEW); + } + + @Override + protected CPreview doCreateCPreview(Composite parent) { + fPreview= new TranslationUnitPreview(fWorkingValues, parent); + return fPreview; + } + + @Override + protected void doUpdatePreview() { + super.doUpdatePreview(); + fPreview.update(); + } + + private CheckboxPreference createPref(Composite composite, int numColumns, String message, String key, String[] values) { + return createCheckboxPref(composite, numColumns, message, key, values); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/LaunchConfigurationAndRestartTestApp.exe b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/LaunchConfigurationAndRestartTestApp.exe new file mode 100755 index 00000000000..106f2a372cc Binary files /dev/null and b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/bin/LaunchConfigurationAndRestartTestApp.exe differ