mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 192656: [Formatter] Indentation of class definition
and 191980: [Formatter] Identation of exception specification
This commit is contained in:
parent
8c248ed68b
commit
928c56b35e
7 changed files with 201 additions and 202 deletions
|
@ -131,16 +131,16 @@ public class DefaultCodeFormatterConstants {
|
|||
// * @see #createAlignmentValue(boolean, int, int)
|
||||
// */
|
||||
// public static final String FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_binary_expression"; //$NON-NLS-1$
|
||||
// /**
|
||||
// * <pre>
|
||||
// * FORMATTER / Option for alignment of compact if
|
||||
// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
|
||||
// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
// * - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
|
||||
// * </pre>
|
||||
// * @see #createAlignmentValue(boolean, int, int)
|
||||
// */
|
||||
// public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option for alignment of compact if
|
||||
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_compact_if"
|
||||
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
* - default: createAlignmentValue(false, WRAP_ONE_PER_LINE, INDENT_BY_ONE)
|
||||
* </pre>
|
||||
* @see #createAlignmentValue(boolean, int, int)
|
||||
*/
|
||||
public static final String FORMATTER_ALIGNMENT_FOR_COMPACT_IF = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_compact_if"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option for alignment of conditional expression
|
||||
|
@ -211,26 +211,26 @@ public class DefaultCodeFormatterConstants {
|
|||
// * @see #createAlignmentValue(boolean, int, int)
|
||||
// */
|
||||
// public static final String FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_selector_in_method_invocation"; //$NON-NLS-1$
|
||||
// /**
|
||||
// * <pre>
|
||||
// * FORMATTER / Option for alignment of superclass in type declaration
|
||||
// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_superclass_in_type_declaration"
|
||||
// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
// * - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
|
||||
// * </pre>
|
||||
// * @see #createAlignmentValue(boolean, int, int)
|
||||
// */
|
||||
// public static final String FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION = CCorePlugin.PLUGIN_ID + ".formatter.alignment_for_superclass_in_type_declaration"; //$NON-NLS-1$
|
||||
// /**
|
||||
// * <pre>
|
||||
// * FORMATTER / Option for alignment of throws clause in method declaration
|
||||
// * - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
|
||||
// * - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
// * - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
|
||||
// * </pre>
|
||||
// * @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$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option for alignment of base-clause in type declaration
|
||||
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration"
|
||||
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
* - default: createAlignmentValue(false, WRAP_NEXT_SHIFTED, INDENT_DEFAULT)
|
||||
* </pre>
|
||||
* @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$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option for alignment of throws clause in method declaration
|
||||
* - option id: "org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration"
|
||||
* - possible values: values returned by <code>createAlignmentValue(boolean, int, int)</code> call
|
||||
* - default: createAlignmentValue(false, WRAP_COMPACT, INDENT_DEFAULT)
|
||||
* </pre>
|
||||
* @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$
|
||||
//
|
||||
// /**
|
||||
// * <pre>
|
||||
|
@ -916,17 +916,17 @@ public class DefaultCodeFormatterConstants {
|
|||
* @see CCorePlugin#DO_NOT_INSERT
|
||||
*/
|
||||
public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_parameters"; //$NON-NLS-1$
|
||||
// /**
|
||||
// * <pre>
|
||||
// * FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
|
||||
// * - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
|
||||
// * - possible values: { INSERT, DO_NOT_INSERT }
|
||||
// * - default: INSERT
|
||||
// * </pre>
|
||||
// * @see CCorePlugin#INSERT
|
||||
// * @see CCorePlugin#DO_NOT_INSERT
|
||||
// */
|
||||
// public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option to insert a space after the comma in the exception names in a throws clause of a method declaration
|
||||
* - option id: "org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws"
|
||||
* - possible values: { INSERT, DO_NOT_INSERT }
|
||||
* - default: INSERT
|
||||
* </pre>
|
||||
* @see CCorePlugin#INSERT
|
||||
* @see CCorePlugin#DO_NOT_INSERT
|
||||
*/
|
||||
public static final String FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_after_comma_in_method_declaration_throws"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option to insert a space after the comma in the arguments of a method invocation
|
||||
|
@ -1488,17 +1488,17 @@ public class DefaultCodeFormatterConstants {
|
|||
* @see CCorePlugin#DO_NOT_INSERT
|
||||
*/
|
||||
public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_parameters"; //$NON-NLS-1$
|
||||
// /**
|
||||
// * <pre>
|
||||
// * FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
|
||||
// * - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
|
||||
// * - possible values: { INSERT, DO_NOT_INSERT }
|
||||
// * - default: DO_NOT_INSERT
|
||||
// * </pre>
|
||||
// * @see CCorePlugin#INSERT
|
||||
// * @see CCorePlugin#DO_NOT_INSERT
|
||||
// */
|
||||
// public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option to insert a space before comma in the exception names of the throws clause of a method declaration
|
||||
* - option id: "org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws"
|
||||
* - possible values: { INSERT, DO_NOT_INSERT }
|
||||
* - default: DO_NOT_INSERT
|
||||
* </pre>
|
||||
* @see CCorePlugin#INSERT
|
||||
* @see CCorePlugin#DO_NOT_INSERT
|
||||
*/
|
||||
public static final String FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS = CCorePlugin.PLUGIN_ID + ".formatter.insert_space_before_comma_in_method_declaration_throws"; //$NON-NLS-1$
|
||||
/**
|
||||
* <pre>
|
||||
* FORMATTER / Option to insert a space before comma in the arguments of a method invocation
|
||||
|
|
|
@ -949,12 +949,8 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
final IASTName member= node.getMemberInitializerId();
|
||||
if (member!= null) {
|
||||
member.accept(this);
|
||||
scribe.printNextToken(Token.tLPAREN, false);
|
||||
final IASTExpression value= node.getInitializerValue();
|
||||
if (value != null) {
|
||||
value.accept(this);
|
||||
}
|
||||
scribe.printNextToken(Token.tRPAREN, false);
|
||||
// format like a function call
|
||||
formatFunctionCallArguments(node.getInitializerValue());
|
||||
} else {
|
||||
formatRaw(node);
|
||||
}
|
||||
|
@ -1052,12 +1048,10 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
}
|
||||
|
||||
private void formatExceptionSpecification(final IASTTypeId[] exceptionSpecification) {
|
||||
// TLETODO [formatter] need special alignment for exception specification
|
||||
if (exceptionSpecification.length > 0) {
|
||||
Alignment alignment =scribe.createAlignment(
|
||||
"exceptionSpecification", //$NON-NLS-1$
|
||||
// need configurable alignment
|
||||
Alignment.M_COMPACT_SPLIT,
|
||||
preferences.alignment_for_throws_clause_in_method_declaration,
|
||||
exceptionSpecification.length,
|
||||
scribe.scanner.getCurrentPosition());
|
||||
|
||||
|
@ -1067,19 +1061,23 @@ 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.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_initializer_list);
|
||||
scribe.printNextToken(Token.tCOMMA, preferences.insert_space_before_comma_in_method_declaration_throws);
|
||||
scribe.printTrailingComment();
|
||||
// insert_space_after_comma_in_method_declaration_throws
|
||||
if (preferences.insert_space_after_comma_in_initializer_list) {
|
||||
if (preferences.insert_space_after_comma_in_method_declaration_throws) {
|
||||
scribe.space();
|
||||
}
|
||||
scribe.alignFragment(alignment, i);
|
||||
exceptionSpecification[i].accept(this);
|
||||
}
|
||||
// preferences.insert_space_before_closing_paren_in_exception_specification_throw
|
||||
scribe.printNextToken(Token.tRPAREN, scribe.printComment());
|
||||
ok = true;
|
||||
} catch (AlignmentException e) {
|
||||
|
@ -1385,7 +1383,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
if (preferences.insert_space_after_colon_in_base_clause) {
|
||||
scribe.space();
|
||||
}
|
||||
final ListAlignment align= new ListAlignment(Alignment.M_COMPACT_SPLIT);
|
||||
final ListAlignment align= new ListAlignment(preferences.alignment_for_base_clause_in_type_declaration);
|
||||
align.fSpaceAfterComma= preferences.insert_space_after_comma_in_base_types;
|
||||
align.fSpaceBeforeComma= preferences.insert_space_before_comma_in_base_types;
|
||||
formatList(baseSpecifiers, align, false, false);
|
||||
|
@ -2346,7 +2344,7 @@ public class CodeFormatterVisitor extends CPPASTVisitor {
|
|||
scribe.printNextToken(Token.tRBRACE, true);
|
||||
scribe.printTrailingComment();
|
||||
} else {
|
||||
formatLeftCurlyBrace(line, preferences.brace_position_for_block);
|
||||
formatLeftCurlyBrace(line, preferences.brace_position_for_block);
|
||||
thenStatement.accept(this);
|
||||
if (elseStatement != null && (preferences.insert_new_line_before_else_in_if_statement)) {
|
||||
scribe.startNewLine();
|
||||
|
|
|
@ -65,8 +65,8 @@ public class DefaultCodeFormatterOptions {
|
|||
public int alignment_for_enumerator_list;
|
||||
public int alignment_for_expression_list;
|
||||
public int alignment_for_parameters_in_method_declaration;
|
||||
// public int alignment_for_superclass_in_type_declaration;
|
||||
// public int alignment_for_throws_clause_in_method_declaration;
|
||||
public int alignment_for_base_clause_in_type_declaration;
|
||||
public int alignment_for_throws_clause_in_method_declaration;
|
||||
|
||||
// public boolean align_type_members_on_columns;
|
||||
|
||||
|
@ -137,7 +137,7 @@ public class DefaultCodeFormatterOptions {
|
|||
// public boolean insert_space_after_comma_in_for_inits;
|
||||
public boolean insert_space_after_comma_in_method_invocation_arguments;
|
||||
public boolean insert_space_after_comma_in_method_declaration_parameters;
|
||||
// public boolean insert_space_after_comma_in_method_declaration_throws;
|
||||
public boolean insert_space_after_comma_in_method_declaration_throws;
|
||||
public boolean insert_space_after_comma_in_declarator_list;
|
||||
public boolean insert_space_after_comma_in_expression_list;
|
||||
public boolean insert_space_after_comma_in_base_types;
|
||||
|
@ -189,7 +189,7 @@ public class DefaultCodeFormatterOptions {
|
|||
// public boolean insert_space_before_comma_in_for_inits;
|
||||
public boolean insert_space_before_comma_in_method_invocation_arguments;
|
||||
public boolean insert_space_before_comma_in_method_declaration_parameters;
|
||||
// public boolean insert_space_before_comma_in_method_declaration_throws;
|
||||
public boolean insert_space_before_comma_in_method_declaration_throws;
|
||||
public boolean insert_space_before_comma_in_declarator_list;
|
||||
public boolean insert_space_before_comma_in_expression_list;
|
||||
public boolean insert_space_before_comma_in_base_types;
|
||||
|
@ -259,7 +259,7 @@ public class DefaultCodeFormatterOptions {
|
|||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION, getAlignment(this.alignment_for_arguments_in_method_invocation));
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ASSIGNMENT, getAlignment(this.alignment_for_assignment));
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BINARY_EXPRESSION, getAlignment(this.alignment_for_binary_expression));
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF, getAlignment(this.alignment_for_compact_if));
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION, getAlignment(this.alignment_for_conditional_expression));
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_INITIALIZER_LIST, getAlignment(this.alignment_for_expressions_in_initializer_list));
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_DECLARATOR_LIST, getAlignment(this.alignment_for_declarator_list));
|
||||
|
@ -267,8 +267,8 @@ public class DefaultCodeFormatterOptions {
|
|||
options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSION_LIST, getAlignment(this.alignment_for_expression_list));
|
||||
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_SUPERCLASS_IN_TYPE_DECLARATION, getAlignment(this.alignment_for_superclass_in_type_declaration));
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION, getAlignment(this.alignment_for_throws_clause_in_method_declaration));
|
||||
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_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);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_BRACE_POSITION_FOR_BLOCK, this.brace_position_for_block);
|
||||
|
@ -332,7 +332,7 @@ public class DefaultCodeFormatterOptions {
|
|||
// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS, this.insert_space_after_comma_in_for_inits? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_after_comma_in_method_invocation_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_after_comma_in_method_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_after_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_after_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, this.insert_space_after_comma_in_declarator_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPRESSION_LIST, this.insert_space_after_comma_in_expression_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_BASE_TYPES, this.insert_space_after_comma_in_base_types? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
|
@ -384,7 +384,7 @@ public class DefaultCodeFormatterOptions {
|
|||
// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, this.insert_space_before_comma_in_for_inits? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, this.insert_space_before_comma_in_method_invocation_arguments? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, this.insert_space_before_comma_in_method_declaration_parameters? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
// options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_before_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, this.insert_space_before_comma_in_method_declaration_throws? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_DECLARATOR_LIST, this.insert_space_before_comma_in_declarator_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPRESSION_LIST, this.insert_space_before_comma_in_expression_list? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
options.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_BASE_TYPES, this.insert_space_before_comma_in_base_types? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
|
||||
|
@ -485,16 +485,16 @@ public class DefaultCodeFormatterOptions {
|
|||
// this.alignment_for_binary_expression = Alignment.M_COMPACT_SPLIT;
|
||||
// }
|
||||
// }
|
||||
// final Object alignmentForCompactIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF);
|
||||
// if (alignmentForCompactIfOption != null) {
|
||||
// try {
|
||||
// this.alignment_for_compact_if = Integer.parseInt((String) alignmentForCompactIfOption);
|
||||
// } catch (NumberFormatException e) {
|
||||
// this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
|
||||
// } catch (ClassCastException e) {
|
||||
// this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
|
||||
// }
|
||||
// }
|
||||
final Object alignmentForCompactIfOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF);
|
||||
if (alignmentForCompactIfOption != null) {
|
||||
try {
|
||||
this.alignment_for_compact_if = Integer.parseInt((String) alignmentForCompactIfOption);
|
||||
} catch (NumberFormatException e) {
|
||||
this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
|
||||
} catch (ClassCastException e) {
|
||||
this.alignment_for_compact_if = Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_INDENT_BY_ONE;
|
||||
}
|
||||
}
|
||||
final Object alignmentForConditionalExpressionOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION);
|
||||
if (alignmentForConditionalExpressionOption != null) {
|
||||
try {
|
||||
|
@ -555,26 +555,26 @@ public class DefaultCodeFormatterOptions {
|
|||
this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
}
|
||||
}
|
||||
// final Object alignmentForSuperclassInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION);
|
||||
// if (alignmentForSuperclassInTypeDeclarationOption != null) {
|
||||
// try {
|
||||
// this.alignment_for_superclass_in_type_declaration = Integer.parseInt((String) alignmentForSuperclassInTypeDeclarationOption);
|
||||
// } catch (NumberFormatException e) {
|
||||
// this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
|
||||
// } catch(ClassCastException e) {
|
||||
// this.alignment_for_superclass_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
|
||||
// }
|
||||
// }
|
||||
// final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION);
|
||||
// if (alignmentForThrowsClauseInMethodDeclarationOption != null) {
|
||||
// try {
|
||||
// this.alignment_for_throws_clause_in_method_declaration = Integer.parseInt((String) alignmentForThrowsClauseInMethodDeclarationOption);
|
||||
// } catch (NumberFormatException e) {
|
||||
// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
// } catch(ClassCastException e) {
|
||||
// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
// }
|
||||
// }
|
||||
final Object alignmentForBaseClauseInTypeDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION);
|
||||
if (alignmentForBaseClauseInTypeDeclarationOption != null) {
|
||||
try {
|
||||
this.alignment_for_base_clause_in_type_declaration = Integer.parseInt((String) alignmentForBaseClauseInTypeDeclarationOption);
|
||||
} catch (NumberFormatException e) {
|
||||
this.alignment_for_base_clause_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
|
||||
} catch(ClassCastException e) {
|
||||
this.alignment_for_base_clause_in_type_declaration = Alignment.M_NEXT_SHIFTED_SPLIT;
|
||||
}
|
||||
}
|
||||
final Object alignmentForThrowsClauseInMethodDeclarationOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION);
|
||||
if (alignmentForThrowsClauseInMethodDeclarationOption != null) {
|
||||
try {
|
||||
this.alignment_for_throws_clause_in_method_declaration = Integer.parseInt((String) alignmentForThrowsClauseInMethodDeclarationOption);
|
||||
} catch (NumberFormatException e) {
|
||||
this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
} catch(ClassCastException e) {
|
||||
this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
}
|
||||
}
|
||||
// final Object alignTypeMembersOnColumnsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_ALIGN_TYPE_MEMBERS_ON_COLUMNS);
|
||||
// if (alignTypeMembersOnColumnsOption != null) {
|
||||
// this.align_type_members_on_columns = DefaultCodeFormatterConstants.TRUE.equals(alignTypeMembersOnColumnsOption);
|
||||
|
@ -937,10 +937,10 @@ public class DefaultCodeFormatterOptions {
|
|||
if (insertSpaceAfterCommaInMethodDeclarationParametersOption != null) {
|
||||
this.insert_space_after_comma_in_method_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodDeclarationParametersOption);
|
||||
}
|
||||
// final Object insertSpaceAfterCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS);
|
||||
// if (insertSpaceAfterCommaInMethodDeclarationThrowsOption != null) {
|
||||
// this.insert_space_after_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodDeclarationThrowsOption);
|
||||
// }
|
||||
final Object insertSpaceAfterCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS);
|
||||
if (insertSpaceAfterCommaInMethodDeclarationThrowsOption != null) {
|
||||
this.insert_space_after_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMethodDeclarationThrowsOption);
|
||||
}
|
||||
final Object insertSpaceAfterCommaInMultipleFieldDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST);
|
||||
if (insertSpaceAfterCommaInMultipleFieldDeclarationsOption != null) {
|
||||
this.insert_space_after_comma_in_declarator_list = CCorePlugin.INSERT.equals(insertSpaceAfterCommaInMultipleFieldDeclarationsOption);
|
||||
|
@ -1149,10 +1149,10 @@ public class DefaultCodeFormatterOptions {
|
|||
if (insertSpaceBeforeCommaInMethodDeclarationParametersOption != null) {
|
||||
this.insert_space_before_comma_in_method_declaration_parameters = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodDeclarationParametersOption);
|
||||
}
|
||||
// final Object insertSpaceBeforeCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS);
|
||||
// if (insertSpaceBeforeCommaInMethodDeclarationThrowsOption != null) {
|
||||
// this.insert_space_before_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodDeclarationThrowsOption);
|
||||
// }
|
||||
final Object insertSpaceBeforeCommaInMethodDeclarationThrowsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS);
|
||||
if (insertSpaceBeforeCommaInMethodDeclarationThrowsOption != null) {
|
||||
this.insert_space_before_comma_in_method_declaration_throws = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMethodDeclarationThrowsOption);
|
||||
}
|
||||
final Object insertSpaceBeforeCommaInMultipleFieldDeclarationsOption = settings.get(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_DECLARATOR_LIST);
|
||||
if (insertSpaceBeforeCommaInMultipleFieldDeclarationsOption != null) {
|
||||
this.insert_space_before_comma_in_declarator_list = CCorePlugin.INSERT.equals(insertSpaceBeforeCommaInMultipleFieldDeclarationsOption);
|
||||
|
@ -1375,8 +1375,8 @@ public class DefaultCodeFormatterOptions {
|
|||
this.alignment_for_enumerator_list = Alignment.M_ONE_PER_LINE_SPLIT;
|
||||
this.alignment_for_parameters_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
// this.alignment_for_selector_in_method_invocation = Alignment.M_COMPACT_SPLIT;
|
||||
// this.alignment_for_superclass_in_type_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
// this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
this.alignment_for_base_clause_in_type_declaration = Alignment.M_NEXT_PER_LINE_SPLIT;
|
||||
this.alignment_for_throws_clause_in_method_declaration = Alignment.M_COMPACT_SPLIT;
|
||||
// this.align_type_members_on_columns = false;
|
||||
this.brace_position_for_initializer_list = DefaultCodeFormatterConstants.END_OF_LINE;
|
||||
this.brace_position_for_block = DefaultCodeFormatterConstants.END_OF_LINE;
|
||||
|
@ -1442,7 +1442,7 @@ public class DefaultCodeFormatterOptions {
|
|||
this.insert_space_after_comma_in_enum_declarations = true;
|
||||
this.insert_space_after_comma_in_method_invocation_arguments = true;
|
||||
this.insert_space_after_comma_in_method_declaration_parameters = true;
|
||||
// this.insert_space_after_comma_in_method_declaration_throws = true;
|
||||
this.insert_space_after_comma_in_method_declaration_throws = true;
|
||||
this.insert_space_after_comma_in_declarator_list = true;
|
||||
this.insert_space_after_comma_in_expression_list = true;
|
||||
this.insert_space_after_comma_in_base_types = true;
|
||||
|
@ -1495,7 +1495,7 @@ public class DefaultCodeFormatterOptions {
|
|||
// this.insert_space_before_comma_in_for_inits = false;
|
||||
this.insert_space_before_comma_in_method_invocation_arguments = false;
|
||||
this.insert_space_before_comma_in_method_declaration_parameters = false;
|
||||
// this.insert_space_before_comma_in_method_declaration_throws = false;
|
||||
this.insert_space_before_comma_in_method_declaration_throws = false;
|
||||
this.insert_space_before_comma_in_declarator_list = false;
|
||||
this.insert_space_before_comma_in_expression_list = false;
|
||||
this.insert_space_before_comma_in_base_types = false;
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.cdt.ui.tests.BaseUITestCase;
|
|||
|
||||
import org.eclipse.cdt.internal.corext.util.CodeFormatterUtil;
|
||||
import org.eclipse.cdt.internal.formatter.DefaultCodeFormatterOptions;
|
||||
import org.eclipse.cdt.internal.formatter.align.Alignment;
|
||||
|
||||
/**
|
||||
* Tests for the CodeFormatter.
|
||||
|
@ -491,4 +492,43 @@ public class CodeFormatterTest extends BaseUITestCase {
|
|||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, CCorePlugin.DO_NOT_INSERT);
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//class Example: public FooClass, public virtual BarClass {};
|
||||
|
||||
//class Example:
|
||||
// public FooClass,
|
||||
// public virtual BarClass {
|
||||
//};
|
||||
public void testAlignmentOfClassDefinitionBaseClause1_Bug192656() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION,
|
||||
Integer.toString(Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_FORCE));
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//class Example: public FooClass, public virtual BarClass {};
|
||||
|
||||
//class Example: public FooClass,
|
||||
// public virtual BarClass {
|
||||
//};
|
||||
public void testAlignmentOfClassDefinitionBaseClause2_Bug192656() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION,
|
||||
Integer.toString(Alignment.M_NEXT_PER_LINE_SPLIT | Alignment.M_FORCE | Alignment.M_INDENT_ON_COLUMN));
|
||||
assertFormatterResult();
|
||||
}
|
||||
|
||||
//class Example: { void foo() throw(int); };
|
||||
//void Example::foo()throw(int){}
|
||||
|
||||
//class Example: {
|
||||
// void foo()
|
||||
// throw(int);
|
||||
//};
|
||||
//void Example::foo()
|
||||
// throw(int) {
|
||||
//}
|
||||
public void testAlignmentOfExceptionSpecificationInMethodDeclaration_Bug191980() throws Exception {
|
||||
fOptions.put(DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION,
|
||||
Integer.toString(Alignment.M_ONE_PER_LINE_SPLIT | Alignment.M_FORCE | Alignment.M_INDENT_BY_ONE));
|
||||
assertFormatterResult();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,29 +207,23 @@ final class FormatterMessages extends NLS {
|
|||
public static String WhiteSpaceOptions_after_ellipsis;
|
||||
public static String WhiteSpaceOptions_return_with_parenthesized_expression;
|
||||
public static String WhiteSpaceOptions_throw_with_parenthesized_expression;
|
||||
// public static String LineWrappingTabPage_compact_if_else;
|
||||
public static String LineWrappingTabPage_base_clause;
|
||||
public static String LineWrappingTabPage_compact_if_else;
|
||||
public static String LineWrappingTabPage_parameters;
|
||||
public static String LineWrappingTabPage_parameters_description;
|
||||
public static String LineWrappingTabPage_arguments;
|
||||
public static String LineWrappingTabPage_arguments_description;
|
||||
// public static String LineWrappingTabPage_throws_clause;
|
||||
public static String LineWrappingTabPage_throws_clause;
|
||||
public static String LineWrappingTabPage_initializer_list;
|
||||
public static String LineWrappingTabPage_initializer_list_description;
|
||||
public static String LineWrappingTabPage_conditionals;
|
||||
public static String LineWrappingTabPage_conditionals_description;
|
||||
// public static String LineWrappingTabPage_binary_exprs;
|
||||
public static String LineWrappingTabPage_indentation_default;
|
||||
public static String LineWrappingTabPage_indentation_on_column;
|
||||
public static String LineWrappingTabPage_indentation_by_one;
|
||||
// public static String LineWrappingTabPage_class_decls;
|
||||
public static String LineWrappingTabPage_class_decls;
|
||||
public static String LineWrappingTabPage_method_decls;
|
||||
public static String LineWrappingTabPage_method_decls_description;
|
||||
// public static String LineWrappingTabPage_constructor_decls;
|
||||
public static String LineWrappingTabPage_function_calls;
|
||||
public static String LineWrappingTabPage_function_calls_description;
|
||||
public static String LineWrappingTabPage_expressions;
|
||||
public static String LineWrappingTabPage_expressions_description;
|
||||
// public static String LineWrappingTabPage_statements;
|
||||
public static String LineWrappingTabPage_statements;
|
||||
public static String LineWrappingTabPage_wrapping_policy_label_text;
|
||||
public static String LineWrappingTabPage_indentation_policy_label_text;
|
||||
public static String LineWrappingTabPage_force_split_checkbox_text;
|
||||
|
|
|
@ -237,30 +237,24 @@ WhiteSpaceOptions_after_ellipsis=After Ellipsis
|
|||
WhiteSpaceTabPage_insert_space=&Insert space:
|
||||
|
||||
|
||||
#LineWrappingTabPage_compact_if_else=Compact 'if else'
|
||||
LineWrappingTabPage_base_clause=Base-clause
|
||||
LineWrappingTabPage_compact_if_else=Compact 'if else'
|
||||
LineWrappingTabPage_parameters=Parameters
|
||||
LineWrappingTabPage_parameters_description=parameters
|
||||
LineWrappingTabPage_arguments=Arguments
|
||||
LineWrappingTabPage_arguments_description=arguments
|
||||
#LineWrappingTabPage_throws_clause='throws' clause
|
||||
LineWrappingTabPage_throws_clause=Exception specification
|
||||
#LineWrappingTabPage_object_allocation=Object allocation arguments
|
||||
LineWrappingTabPage_initializer_list=Initializer List
|
||||
LineWrappingTabPage_initializer_list_description=initializer list
|
||||
LineWrappingTabPage_conditionals=Conditionals
|
||||
LineWrappingTabPage_conditionals_description=conditionals
|
||||
#LineWrappingTabPage_binary_exprs=Binary expressions
|
||||
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_class_decls=Class Declarations
|
||||
LineWrappingTabPage_method_decls=Function Declarations
|
||||
LineWrappingTabPage_method_decls_description=function declarations
|
||||
#LineWrappingTabPage_constructor_decls=Constructor declarations
|
||||
LineWrappingTabPage_function_calls=Function Calls
|
||||
LineWrappingTabPage_function_calls_description=function calls
|
||||
LineWrappingTabPage_expressions=Expressions
|
||||
LineWrappingTabPage_expressions_description=expressions
|
||||
#LineWrappingTabPage_statements=Statements
|
||||
LineWrappingTabPage_statements=Statements
|
||||
LineWrappingTabPage_wrapping_policy_label_text=Lin&e wrapping policy:
|
||||
LineWrappingTabPage_indentation_policy_label_text=Indent&ation policy:
|
||||
LineWrappingTabPage_force_split_checkbox_text=&Force split
|
||||
|
|
|
@ -61,16 +61,14 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
private final static class Category {
|
||||
public final String key;
|
||||
public final String name;
|
||||
public final String description;
|
||||
public final String previewText;
|
||||
public final List children;
|
||||
|
||||
public int index;
|
||||
|
||||
public Category(String _key, String _previewText, String _name, String _description) {
|
||||
public Category(String _key, String _previewText, String _name) {
|
||||
this.key= _key;
|
||||
this.name= _name;
|
||||
this.description = _description;
|
||||
this.previewText= _previewText != null ? createPreviewHeader(_name) + _previewText : null;
|
||||
children= new ArrayList();
|
||||
}
|
||||
|
@ -78,8 +76,8 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
/**
|
||||
* @param _name Category name
|
||||
*/
|
||||
public Category(String _name, String _description) {
|
||||
this(null, null, _name, _description);
|
||||
public Category(String _name) {
|
||||
this(null, null, _name);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -139,8 +137,8 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
private String getGroupLabel(Category category) {
|
||||
if (fSelection.size() == 1) {
|
||||
if (fSelectionState.getElements().size() == 1)
|
||||
return Messages.format(FormatterMessages.LineWrappingTabPage_group, category.description);
|
||||
return Messages.format(FormatterMessages.LineWrappingTabPage_multi_group, new String[] {category.description, Integer.toString(fSelectionState.getElements().size())});
|
||||
return Messages.format(FormatterMessages.LineWrappingTabPage_group, category.name.toLowerCase());
|
||||
return Messages.format(FormatterMessages.LineWrappingTabPage_multi_group, new String[] {category.name.toLowerCase(), Integer.toString(fSelectionState.getElements().size())});
|
||||
}
|
||||
return Messages.format(FormatterMessages.LineWrappingTabPage_multiple_selections, new String[] {Integer.toString(fSelectionState.getElements().size())});
|
||||
}
|
||||
|
@ -356,29 +354,21 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
|
||||
// private final Category fCompactIfCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_COMPACT_IF,
|
||||
// "class Example {" + //$NON-NLS-1$
|
||||
// "int foo(int argument) {" + //$NON-NLS-1$
|
||||
// " if (argument==0) return 0;" + //$NON-NLS-1$
|
||||
// " if (argument==1) return 42; else return 43;" + //$NON-NLS-1$
|
||||
// "}}", //$NON-NLS-1$
|
||||
// "}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_compact_if_else
|
||||
// );
|
||||
//
|
||||
//
|
||||
// private final Category fTypeDeclarationSuperclassCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERCLASS_IN_TYPE_DECLARATION,
|
||||
// "class Example extends OtherClass {}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_extends_clause
|
||||
// );
|
||||
//
|
||||
//
|
||||
// private final Category fTypeDeclarationSuperinterfacesCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_TYPE_DECLARATION,
|
||||
// "class Example implements I1, I2, I3 {}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_implements_clause
|
||||
// );
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
private final Category fTypeDeclarationBaseClauseCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_BASE_CLAUSE_IN_TYPE_DECLARATION,
|
||||
"class Example : public FooClass, virtual protected BarClass {};", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_base_clause
|
||||
);
|
||||
|
||||
|
||||
// private final Category fConstructorDeclarationsParametersCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_CONSTRUCTOR_DECLARATION,
|
||||
// "class Example {Example(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) { this();}" + //$NON-NLS-1$
|
||||
|
@ -389,32 +379,24 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
private final Category fMethodDeclarationsParametersCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_PARAMETERS_IN_METHOD_DECLARATION,
|
||||
"class Example {void foo(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6) {}};", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_parameters,
|
||||
FormatterMessages.LineWrappingTabPage_parameters_description
|
||||
FormatterMessages.LineWrappingTabPage_parameters
|
||||
);
|
||||
|
||||
private final Category fMessageSendArgumentsCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_METHOD_INVOCATION,
|
||||
"class Other {static void bar(int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9) {}};"+ //$NON-NLS-1$
|
||||
"void foo() {Other::bar(100, 200, 300, 400, 500, 600, 700, 800, 900);}", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_arguments,
|
||||
FormatterMessages.LineWrappingTabPage_arguments_description
|
||||
FormatterMessages.LineWrappingTabPage_arguments
|
||||
);
|
||||
|
||||
// private final Category fMessageSendSelectorCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_SELECTOR_IN_METHOD_INVOCATION,
|
||||
// "class Example {int foo(Some a) {return a.getFirst();}}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_qualified_invocations
|
||||
// );
|
||||
//
|
||||
// private final Category fMethodThrowsClauseCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION,
|
||||
// "class Example {" + //$NON-NLS-1$
|
||||
// "int foo() throws FirstException, SecondException, ThirdException {" + //$NON-NLS-1$
|
||||
// " return Other.doSomething();}}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_throws_clause
|
||||
// );
|
||||
//
|
||||
private final Category fMethodThrowsClauseCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_METHOD_DECLARATION,
|
||||
"class Example {" + //$NON-NLS-1$
|
||||
"int foo() throw(FirstException, SecondException, ThirdException) {" + //$NON-NLS-1$
|
||||
" return Other::doSomething();}};", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_throws_clause
|
||||
);
|
||||
|
||||
// private final Category fConstructorThrowsClauseCategory= new Category(
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_THROWS_CLAUSE_IN_CONSTRUCTOR_DECLARATION,
|
||||
// "class Example {" + //$NON-NLS-1$
|
||||
|
@ -428,19 +410,12 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
// 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$
|
||||
// FormatterMessages.LineWrappingTabPage_object_allocation
|
||||
// );
|
||||
//
|
||||
// private final Category fQualifiedAllocationExpressionCategory= new Category (
|
||||
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_QUALIFIED_ALLOCATION_EXPRESSION,
|
||||
// "class Example {SomeClass foo() {return SomeOtherClass.new SomeClass(100, 200, 300, 400, 500 );}}", //$NON-NLS-1$
|
||||
// FormatterMessages.LineWrappingTabPage_qualified_object_allocation
|
||||
// );
|
||||
|
||||
private final Category fArrayInitializerExpressionsCategory= new Category(
|
||||
private final Category fInitializerListExpressionsCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_EXPRESSIONS_IN_INITIALIZER_LIST,
|
||||
"int array[]= {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_initializer_list,
|
||||
FormatterMessages.LineWrappingTabPage_initializer_list_description
|
||||
FormatterMessages.LineWrappingTabPage_initializer_list
|
||||
);
|
||||
|
||||
// private final Category fExplicitConstructorArgumentsCategory= new Category(
|
||||
|
@ -452,8 +427,7 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
private final Category fConditionalExpressionCategory= new Category(
|
||||
DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_CONDITIONAL_EXPRESSION,
|
||||
"int compare(int argument, int argument2) {return argument > argument2 ? 100000 : 200000;}", //$NON-NLS-1$
|
||||
FormatterMessages.LineWrappingTabPage_conditionals,
|
||||
FormatterMessages.LineWrappingTabPage_conditionals_description
|
||||
FormatterMessages.LineWrappingTabPage_conditionals
|
||||
);
|
||||
|
||||
// private final Category fBinaryExpressionCategory= new Category(
|
||||
|
@ -582,41 +556,40 @@ public class LineWrappingTabPage extends FormatterTabPage {
|
|||
*/
|
||||
protected List createCategories() {
|
||||
|
||||
// final Category classDeclarations= new Category(FormatterMessages.LineWrappingTabPage_class_decls);
|
||||
// classDeclarations.children.add(fTypeDeclarationSuperclassCategory);
|
||||
// classDeclarations.children.add(fTypeDeclarationSuperinterfacesCategory);
|
||||
final Category classDeclarations= new Category(FormatterMessages.LineWrappingTabPage_class_decls);
|
||||
classDeclarations.children.add(fTypeDeclarationBaseClauseCategory);
|
||||
|
||||
// final Category constructorDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_constructor_decls);
|
||||
// constructorDeclarations.children.add(fConstructorDeclarationsParametersCategory);
|
||||
// constructorDeclarations.children.add(fConstructorThrowsClauseCategory);
|
||||
|
||||
final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_method_decls, FormatterMessages.LineWrappingTabPage_method_decls_description);
|
||||
final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_method_decls);
|
||||
methodDeclarations.children.add(fMethodDeclarationsParametersCategory);
|
||||
// methodDeclarations.children.add(fMethodThrowsClauseCategory);
|
||||
methodDeclarations.children.add(fMethodThrowsClauseCategory);
|
||||
|
||||
// final Category enumDeclarations= new Category(FormatterMessages.LineWrappingTabPage_enum_decls);
|
||||
// enumDeclarations.children.add(fEnumConstantsCategory);
|
||||
// enumDeclarations.children.add(fEnumDeclInterfacesCategory);
|
||||
// enumDeclarations.children.add(fEnumConstArgumentsCategory);
|
||||
|
||||
final Category functionCalls= new Category(FormatterMessages.LineWrappingTabPage_function_calls, FormatterMessages.LineWrappingTabPage_function_calls_description);
|
||||
final Category functionCalls= new Category(FormatterMessages.LineWrappingTabPage_function_calls);
|
||||
functionCalls.children.add(fMessageSendArgumentsCategory);
|
||||
// functionCalls.children.add(fMessageSendSelectorCategory);
|
||||
// functionCalls.children.add(fExplicitConstructorArgumentsCategory);
|
||||
// functionCalls.children.add(fAllocationExpressionArgumentsCategory);
|
||||
// functionCalls.children.add(fQualifiedAllocationExpressionCategory);
|
||||
|
||||
final Category expressions= new Category(FormatterMessages.LineWrappingTabPage_expressions, FormatterMessages.LineWrappingTabPage_expressions_description);
|
||||
final Category expressions= new Category(FormatterMessages.LineWrappingTabPage_expressions);
|
||||
// expressions.children.add(fBinaryExpressionCategory);
|
||||
expressions.children.add(fConditionalExpressionCategory);
|
||||
expressions.children.add(fArrayInitializerExpressionsCategory);
|
||||
expressions.children.add(fInitializerListExpressionsCategory);
|
||||
// expressions.children.add(fAssignmentCategory);
|
||||
|
||||
// final Category statements= new Category(FormatterMessages.LineWrappingTabPage_statements);
|
||||
// statements.children.add(fCompactIfCategory);
|
||||
|
||||
final List root= new ArrayList();
|
||||
// root.add(classDeclarations);
|
||||
root.add(classDeclarations);
|
||||
// root.add(constructorDeclarations);
|
||||
root.add(methodDeclarations);
|
||||
// root.add(enumDeclarations);
|
||||
|
|
Loading…
Add table
Reference in a new issue