View | Details | Raw Unified | Return to bug 150741 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/jdt/internal/ui/preferences/formatter/NewLinesTabPage.java (-1 / +3 lines)
Lines 50-55 Link Here
50
	"  public void\nbar\n()\n {}" + //$NON-NLS-1$
50
	"  public void\nbar\n()\n {}" + //$NON-NLS-1$
51
	"  void foo() {" + //$NON-NLS-1$
51
	"  void foo() {" + //$NON-NLS-1$
52
	"    ;;" + //$NON-NLS-1$
52
	"    ;;" + //$NON-NLS-1$
53
	"    LABEL:" + //$NON-NLS-1$
53
	"    do {} while (false);" + //$NON-NLS-1$
54
	"    do {} while (false);" + //$NON-NLS-1$
54
	"    for (;;) {}" + //$NON-NLS-1$
55
	"    for (;;) {}" + //$NON-NLS-1$
55
	"  }" + //$NON-NLS-1$
56
	"  }" + //$NON-NLS-1$
Lines 76-82 Link Here
76
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_class_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, DO_NOT_INSERT_INSERT); 
77
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_class_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, DO_NOT_INSERT_INSERT); 
77
		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); 
78
		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); 
78
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_method_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, DO_NOT_INSERT_INSERT); 
79
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_method_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, DO_NOT_INSERT_INSERT); 
79
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK, DO_NOT_INSERT_INSERT); 
80
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_BLOCK, DO_NOT_INSERT_INSERT);
81
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_label, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL, DO_NOT_INSERT_INSERT);
80
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, DO_NOT_INSERT_INSERT); 
82
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, DO_NOT_INSERT_INSERT); 
81
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_constant, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT, DO_NOT_INSERT_INSERT);
83
		createPref(newlinesGroup, numColumns, FormatterMessages.NewLinesTabPage_newlines_group_option_empty_enum_constant, DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT, DO_NOT_INSERT_INSERT);
82
		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); 
84
		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); 
(-)ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.java (+1 lines)
Lines 420-425 Link Here
420
	public static String NewLinesTabPage_newlines_group_option_empty_method_body;
420
	public static String NewLinesTabPage_newlines_group_option_empty_method_body;
421
	public static String NewLinesTabPage_newlines_group_option_empty_block;
421
	public static String NewLinesTabPage_newlines_group_option_empty_block;
422
	public static String NewLinesTabPage_newlines_group_option_empty_end_of_file;
422
	public static String NewLinesTabPage_newlines_group_option_empty_end_of_file;
423
	public static String NewLinesTabPage_newlines_group_option_empty_label;
423
	public static String NewLinesTabPage_empty_statement_group_title;
424
	public static String NewLinesTabPage_empty_statement_group_title;
424
	public static String NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line;
425
	public static String NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line;
425
	public static String NewLinesTabPage_arrayInitializer_group_title;
426
	public static String NewLinesTabPage_arrayInitializer_group_title;
(-)ui/org/eclipse/jdt/internal/ui/preferences/formatter/FormatterMessages.properties (+1 lines)
Lines 476-481 Link Here
476
NewLinesTabPage_newlines_group_option_empty_method_body=in empt&y method body
476
NewLinesTabPage_newlines_group_option_empty_method_body=in empt&y method body
477
NewLinesTabPage_newlines_group_option_empty_block=in empty &block
477
NewLinesTabPage_newlines_group_option_empty_block=in empty &block
478
NewLinesTabPage_newlines_group_option_empty_end_of_file=at end of &file
478
NewLinesTabPage_newlines_group_option_empty_end_of_file=at end of &file
479
NewLinesTabPage_newlines_group_option_empty_label=after labels
479
NewLinesTabPage_empty_statement_group_title=Empty statements
480
NewLinesTabPage_empty_statement_group_title=Empty statements
480
NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line=Put empty &statement on new line
481
NewLinesTabPage_emtpy_statement_group_option_empty_statement_on_new_line=Put empty &statement on new line
481
482
(-)formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java (+12 lines)
Lines 1111-1116 Link Here
1111
	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration";	//$NON-NLS-1$
1111
	public static final String FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_in_empty_type_declaration";	//$NON-NLS-1$
1112
	/**
1112
	/**
1113
	 * <pre>
1113
	 * <pre>
1114
	 * FORMATTER / Option to insert a new line after a label
1115
	 *     - option id:         "org.eclipse.jdt.core.formatter.insert_new_line_after_label"
1116
	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1117
	 *     - default:           INSERT
1118
	 * </pre>
1119
	 * @see JavaCore#INSERT
1120
	 * @see JavaCore#DO_NOT_INSERT
1121
	 * @since 3.4
1122
	 */
1123
	public static final String FORMATTER_INSERT_NEW_LINE_AFTER_LABEL = JavaCore.PLUGIN_ID + ".formatter.insert_new_line_after_label";	//$NON-NLS-1$	
1124
	/**
1125
	 * <pre>
1114
	 * FORMATTER / Option to insert a space after and in wilcard
1126
	 * FORMATTER / Option to insert a space after and in wilcard
1115
	 *     - option id:         "org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter"
1127
	 *     - option id:         "org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter"
1116
	 *     - possible values:   { INSERT, DO_NOT_INSERT }
1128
	 *     - possible values:   { INSERT, DO_NOT_INSERT }
(-)formatter/org/eclipse/jdt/internal/formatter/CodeFormatterVisitor.java (+3 lines)
Lines 3941-3946 Link Here
3941
		if (this.preferences.insert_space_after_colon_in_labeled_statement) {
3941
		if (this.preferences.insert_space_after_colon_in_labeled_statement) {
3942
			this.scribe.space();
3942
			this.scribe.space();
3943
		}
3943
		}
3944
		if (this.preferences.insert_new_line_after_label) {
3945
			this.scribe.printNewLine();
3946
		}
3944
		final Statement statement = labeledStatement.statement;
3947
		final Statement statement = labeledStatement.statement;
3945
		statement.traverse(this, scope);
3948
		statement.traverse(this, scope);
3946
		if (statement instanceof Expression) {
3949
		if (statement instanceof Expression) {
(-)formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java (+6 lines)
Lines 137-142 Link Here
137
	public boolean insert_new_line_in_empty_enum_declaration;
137
	public boolean insert_new_line_in_empty_enum_declaration;
138
	public boolean insert_new_line_in_empty_method_body;
138
	public boolean insert_new_line_in_empty_method_body;
139
	public boolean insert_new_line_in_empty_type_declaration;
139
	public boolean insert_new_line_in_empty_type_declaration;
140
	public boolean insert_new_line_after_label;
140
	public boolean insert_space_after_and_in_type_parameter;
141
	public boolean insert_space_after_and_in_type_parameter;
141
	public boolean insert_space_after_assignment_operator;
142
	public boolean insert_space_after_assignment_operator;
142
	public boolean insert_space_after_at_in_annotation;
143
	public boolean insert_space_after_at_in_annotation;
Lines 412-417 Link Here
412
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, this.insert_new_line_in_empty_enum_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
413
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION, this.insert_new_line_in_empty_enum_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
413
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, this.insert_new_line_in_empty_method_body? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
414
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_METHOD_BODY, this.insert_new_line_in_empty_method_body? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
414
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, this.insert_new_line_in_empty_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
415
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_IN_EMPTY_TYPE_DECLARATION, this.insert_new_line_in_empty_type_declaration? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
416
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL, this.insert_new_line_after_label? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
415
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER, this.insert_space_after_and_in_type_parameter? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
417
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER, this.insert_space_after_and_in_type_parameter? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
416
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, this.insert_space_after_assignment_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
418
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, this.insert_space_after_assignment_operator? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
417
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION, this.insert_space_after_at_in_annotation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
419
		options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION, this.insert_space_after_at_in_annotation? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
Lines 1188-1193 Link Here
1188
		if (insertNewLineInEmptyTypeDeclarationOption != null) {
1190
		if (insertNewLineInEmptyTypeDeclarationOption != null) {
1189
			this.insert_new_line_in_empty_type_declaration = JavaCore.INSERT.equals(insertNewLineInEmptyTypeDeclarationOption);
1191
			this.insert_new_line_in_empty_type_declaration = JavaCore.INSERT.equals(insertNewLineInEmptyTypeDeclarationOption);
1190
		}
1192
		}
1193
		final Object insertNewLineAfterLabelOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_NEW_LINE_AFTER_LABEL);
1194
		if (insertNewLineAfterLabelOption != null) {
1195
			this.insert_new_line_after_label = JavaCore.INSERT.equals(insertNewLineAfterLabelOption);
1196
		}
1191
		final Object insertSpaceAfterAndInWildcardOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER);
1197
		final Object insertSpaceAfterAndInWildcardOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_AND_IN_TYPE_PARAMETER);
1192
		if (insertSpaceAfterAndInWildcardOption != null) {
1198
		if (insertSpaceAfterAndInWildcardOption != null) {
1193
			this.insert_space_after_and_in_type_parameter = JavaCore.INSERT.equals(insertSpaceAfterAndInWildcardOption);
1199
			this.insert_space_after_and_in_type_parameter = JavaCore.INSERT.equals(insertSpaceAfterAndInWildcardOption);

Return to bug 150741