Skip to content

Commit

Permalink
Eclipse 4.9 (RC1) JDT Patch for Groovy-Eclipse: JDT commit 987e180
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Sep 2, 2018
1 parent 5c256d2 commit 0029b10
Show file tree
Hide file tree
Showing 13 changed files with 533 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</license>

<requires>
<import feature="org.eclipse.jdt" version="3.15.0.v20180823-0831" patch="true"/>
<import feature="org.eclipse.jdt" version="3.15.0.v20180830-1030" patch="true"/>
</requires>

<plugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class DefaultCodeFormatterConstants {
/**
* <pre>
* FORMATTER / Option to align type members of a type declaration on column
* - option id: "org.eclipse.jdt.core.formatter.formatter.align_type_members_on_columns"
* - option id: "org.eclipse.jdt.core.formatter.align_type_members_on_columns"
* - possible values: { TRUE, FALSE }
* - default: FALSE
* </pre>
Expand All @@ -70,7 +70,49 @@ public class DefaultCodeFormatterConstants {

/**
* <pre>
* FORMATTER / Option to align groups of members independently if they are separated by a certain number of blank lines
* FORMATTER / Option to align variable declarations on column
* - option id: "org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns"
* - possible values: { TRUE, FALSE }
* - default: FALSE
* </pre>
* @see #TRUE
* @see #FALSE
* @since 3.15
*/
public static final String FORMATTER_ALIGN_VARIABLE_DECLARATIONS_ON_COLUMNS = JavaCore.PLUGIN_ID + ".formatter.align_variable_declarations_on_columns"; //$NON-NLS-1$

/**
* <pre>
* FORMATTER / Option to align assignment statements on column
* - option id: "org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns"
* - possible values: { TRUE, FALSE }
* - default: FALSE
* </pre>
* @see #TRUE
* @see #FALSE
* @since 3.15
*/
public static final String FORMATTER_ALIGN_ASSIGNMENT_STATEMENTS_ON_COLUMNS = JavaCore.PLUGIN_ID + ".formatter.align_assignment_statements_on_columns"; //$NON-NLS-1$

/**
* <pre>
* FORMATTER / Option to use spaces when aligning members, independent of selected tabulation character
* - option id: "org.eclipse.jdt.core.formatter.align_with_spaces"
* - possible values: { TRUE, FALSE }
* - default: FALSE
* </pre>
* @see #TRUE
* @see #FALSE
* @since 3.15
*/
public static final String FORMATTER_ALIGN_WITH_SPACES = JavaCore.PLUGIN_ID + ".formatter.align_with_spaces"; //$NON-NLS-1$

/**
* <pre>
* FORMATTER / Option to affect aligning on columns: groups of items are aligned independently
* if they are separated by at least the selected number of blank lines.
* Note: since 3.15 the 'fields' part is a (potentially misleading) residue as this option
* affects other types of aligning on columns as well.
* - option id: "org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines"
* - possible values: "&lt;n&gt;", where n is a positive integer
* - default: {@code Integer.MAX_VALUE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public static DefaultCodeFormatterOptions getJavaConventionsSettings() {
public int alignment_for_union_type_in_multicatch;

public boolean align_type_members_on_columns;
public boolean align_variable_declarations_on_columns;
public boolean align_assignment_statements_on_columns;
public boolean align_with_spaces;
public int align_fields_grouping_blank_lines;

public String brace_position_for_annotation_type_declaration;
Expand Down Expand Up @@ -484,7 +487,10 @@ public Map<String, String> getMap() {
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_TYPE_PARAMETERS, getAlignment(this.alignment_for_type_parameters));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_UNION_TYPE_IN_MULTICATCH, getAlignment(this.alignment_for_union_type_in_multicatch));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS, this.align_type_members_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_VARIABLE_DECLARATIONS_ON_COLUMNS, this.align_variable_declarations_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_ASSIGNMENT_STATEMENTS_ON_COLUMNS, this.align_assignment_statements_on_columns ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_FIELDS_GROUPING_BLANK_LINES, Integer.toString(this.align_fields_grouping_blank_lines));
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGN_WITH_SPACES, this.align_with_spaces ? DefaultCodeFormatterConstants.TRUE : DefaultCodeFormatterConstants.FALSE);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION, this.brace_position_for_annotation_type_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANONYMOUS_TYPE_DECLARATION, this.brace_position_for_anonymous_type_declaration);
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ARRAY_INITIALIZER, this.brace_position_for_array_initializer);
Expand Down Expand Up @@ -1045,6 +1051,14 @@ public void set(Map<String, String> settings) {
if (alignTypeMembersOnColumnsOption != null) {
this.align_type_members_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignTypeMembersOnColumnsOption);
}
final Object alignVariableDeclarationsOnColumnsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_VARIABLE_DECLARATIONS_ON_COLUMNS);
if (alignVariableDeclarationsOnColumnsOption != null) {
this.align_variable_declarations_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignVariableDeclarationsOnColumnsOption);
}
final Object alignAssignmentStatementsOnColumnsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_ASSIGNMENT_STATEMENTS_ON_COLUMNS);
if (alignAssignmentStatementsOnColumnsOption != null) {
this.align_assignment_statements_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignAssignmentStatementsOnColumnsOption);
}
final Object alignGroupSepartionBlankLinesOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_FIELDS_GROUPING_BLANK_LINES);
if (alignTypeMembersOnColumnsOption != null) {
try {
Expand All @@ -1055,6 +1069,10 @@ public void set(Map<String, String> settings) {
this.align_fields_grouping_blank_lines = Integer.MAX_VALUE;
}
}
final Object alignWithSpaces = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_WITH_SPACES);
if (alignWithSpaces != null) {
this.align_with_spaces = DefaultCodeFormatterConstants.TRUE.equals(alignWithSpaces);
}
final Object bracePositionForAnnotationTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION);
if (bracePositionForAnnotationTypeDeclarationOption != null) {
try {
Expand Down Expand Up @@ -2489,6 +2507,9 @@ public void setDefaultSettings() {
this.alignment_for_type_parameters = Alignment.M_NO_ALIGNMENT;
this.alignment_for_union_type_in_multicatch = Alignment.M_COMPACT_SPLIT;
this.align_type_members_on_columns = false;
this.align_variable_declarations_on_columns = false;
this.align_assignment_statements_on_columns = false;
this.align_with_spaces = false;
this.align_fields_grouping_blank_lines = Integer.MAX_VALUE;
this.brace_position_for_annotation_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
Expand Down Expand Up @@ -2806,6 +2827,9 @@ public void setJavaConventionsSettings() {
this.alignment_for_type_parameters = Alignment.M_NO_ALIGNMENT;
this.alignment_for_union_type_in_multicatch = Alignment.M_COMPACT_SPLIT;
this.align_type_members_on_columns = false;
this.align_variable_declarations_on_columns = false;
this.align_assignment_statements_on_columns = false;
this.align_with_spaces = false;
this.align_fields_grouping_blank_lines = Integer.MAX_VALUE;
this.brace_position_for_annotation_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
this.brace_position_for_anonymous_type_declaration = DefaultCodeFormatterConstants.END_OF_LINE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public TextEditsBuilder(String source, List<IRegion> regions, TokenManager token
this.options = options;
this.regions = adaptRegions(regions);

this.alignChar = this.options.tab_char;
this.alignChar = this.options.align_with_spaces ? DefaultCodeFormatterOptions.SPACE : this.options.tab_char;
this.sourceLimit = source.length();
this.parent = null;

Expand Down
Loading

0 comments on commit 0029b10

Please sign in to comment.