Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Stornelli2019-03-10 13:14:16 -0400
committerJonah Graham2019-04-08 12:58:53 -0400
commite753c628ed910a7729a3c8cd43c84ff707cf7b63 (patch)
tree317b358047a8adbc127d2d3b1073ab9ebd84f6f7
parentd1bd979a00673bcb6fcaa001200ee32cf3def041 (diff)
downloadorg.eclipse.cdt-e753c628ed910a7729a3c8cd43c84ff707cf7b63.tar.gz
org.eclipse.cdt-e753c628ed910a7729a3c8cd43c84ff707cf7b63.tar.xz
org.eclipse.cdt-e753c628ed910a7729a3c8cd43c84ff707cf7b63.zip
Bug 414681 - Added new line empty statement to UI
Formatter has an option for it but the user can't change it without an option in the UI. Change-Id: Ibe3f36bd55b24ef06c13300792e425592285c8ea Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.java3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/FormatterMessages.properties3
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter/NewLinesTabPage.java10
3 files changed, 8 insertions, 8 deletions
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 96b5a256e9..4fd40cc12b 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
@@ -391,12 +391,11 @@ final class FormatterMessages extends NLS {
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_emtpy_statement_on_new_line;
// 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;
// public static String NewLinesTabPage_newlines_group_option_empty_end_of_file;
- // public static String NewLinesTabPage_empty_statement_group_title;
- // public static String NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line;
// public static String NewLinesTabPage_arrayInitializer_group_title;
// public static String NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer;
// public static String NewLinesTabPage_array_group_option_before_closing_brace_of_array_initializer;
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 5ea1c40d74..4887fb0a47 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
@@ -461,12 +461,11 @@ 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_emtpy_statement_on_new_line=before empty statement
#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
#NewLinesTabPage_newlines_group_option_empty_end_of_file=at end of &file
-#NewLinesTabPage_empty_statement_group_title=Empty statements
-#NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line=Put empty &statement on new line
#NewLinesTabPage_arrayInitializer_group_title=Initializer list
#NewLinesTabPage_array_group_option_after_opening_brace_of_array_initializer=Insert new line after openin&g brace of initializer list
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
index b046031ead..07e139c698 100644
--- 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
@@ -30,10 +30,10 @@ public class NewLinesTabPage extends FormatterTabPage {
"private:" + //$NON-NLS-1$
"double x;" + //$NON-NLS-1$
"double y;" + //$NON-NLS-1$
- "};"; //$NON-NLS-1$
-
- protected CheckboxPreference fThenStatementPref;
- protected CheckboxPreference fSimpleIfPref;
+ "};\n\n\n" + //$NON-NLS-1$
+ "void bar() {\n" + //$NON-NLS-1$
+ "for (int i = 0; i < 10; i++);\n" + //$NON-NLS-1$
+ "}"; //$NON-NLS-1$
private TranslationUnitPreview fPreview;
@@ -49,6 +49,8 @@ public class NewLinesTabPage extends FormatterTabPage {
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_emtpy_statement_on_new_line,
+ DefaultCodeFormatterConstants.FORMATTER_PUT_EMPTY_STATEMENT_ON_NEW_LINE, FALSE_TRUE);
// 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);

Back to the top