1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

fix for bug 235453

This commit is contained in:
Vivian Kong 2008-06-05 13:56:09 +00:00
parent 92de3f94c0
commit df30a70eda
3 changed files with 86 additions and 24 deletions

View file

@ -226,6 +226,27 @@ final class FormatterMessages extends NLS {
public static String LineWrappingTabPage_function_calls;
public static String LineWrappingTabPage_expressions;
// public static String LineWrappingTabPage_statements;
public static String LineWrappingTabPage_base_clause_lowercase;
// public static String LineWrappingTabPage_compact_if_else_lowercase;
public static String LineWrappingTabPage_parameters_lowercase;
public static String LineWrappingTabPage_arguments_lowercase;
public static String LineWrappingTabPage_throws_clause_lowercase;
public static String LineWrappingTabPage_enum_decls_lowercase;
public static String LineWrappingTabPage_enumerator_list_lowercase;
public static String LineWrappingTabPage_initializer_list_lowercase;
public static String LineWrappingTabPage_conditionals_lowercase;
// public static String LineWrappingTabPage_binary_exprs_lowercase;
public static String LineWrappingTabPage_indentation_default_lowercase;
public static String LineWrappingTabPage_indentation_on_column_lowercase;
public static String LineWrappingTabPage_indentation_by_one_lowercase;
public static String LineWrappingTabPage_class_decls_lowercase;
public static String LineWrappingTabPage_method_decls_lowercase;
// public static String LineWrappingTabPage_constructor_decls_lowercase;
public static String LineWrappingTabPage_function_calls_lowercase;
public static String LineWrappingTabPage_expressions_lowercase;
// public static String LineWrappingTabPage_statements_lowercase;
public static String LineWrappingTabPage_wrapping_policy_label_text;
public static String LineWrappingTabPage_indentation_policy_label_text;
public static String LineWrappingTabPage_force_split_checkbox_text;

View file

@ -256,6 +256,29 @@ LineWrappingTabPage_method_decls=Function declarations
LineWrappingTabPage_function_calls=Function calls
LineWrappingTabPage_expressions=Expressions
#LineWrappingTabPage_statements=Statements
#lower case table entries description;
LineWrappingTabPage_base_clause_lowercase=base-clause
#LineWrappingTabPage_compact_if_else_lowercase=compact 'if else'
LineWrappingTabPage_parameters_lowercase=parameters
LineWrappingTabPage_arguments_lowercase=arguments
LineWrappingTabPage_throws_clause_lowercase=exception specification
#LineWrappingTabPage_object_allocation_lowercase=object allocation arguments
LineWrappingTabPage_enum_decls_lowercase='enum' declaration
LineWrappingTabPage_enumerator_list_lowercase=enumerator list
LineWrappingTabPage_initializer_list_lowercase=initializer list
LineWrappingTabPage_conditionals_lowercase=conditionals
#LineWrappingTabPage_binary_exprs_lowercase=binary expressions
LineWrappingTabPage_indentation_default_lowercase=default indentation
LineWrappingTabPage_indentation_on_column_lowercase=indent on column
LineWrappingTabPage_indentation_by_one_lowercase=indent by one
LineWrappingTabPage_class_decls_lowercase=class declarations
LineWrappingTabPage_method_decls_lowercase=function declarations
#LineWrappingTabPage_constructor_decls_lowercase=constructor declarations
LineWrappingTabPage_function_calls_lowercase=function calls
LineWrappingTabPage_expressions_lowercase=expressions
#LineWrappingTabPage_statements_lowercase=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

View file

@ -62,22 +62,24 @@ public class LineWrappingTabPage extends FormatterTabPage {
public final String key;
public final String name;
public final String previewText;
public final String description; //bug 235453: for categories' labels
public final List<Category> children;
public int index;
public Category(String _key, String _previewText, String _name) {
public Category(String _key, String _previewText, String _name, String _description) {
this.key= _key;
this.name= _name;
this.previewText= _previewText != null ? createPreviewHeader(_name) + _previewText : null;
this.previewText= _previewText != null ? createPreviewHeader(_name) + _previewText : null;
this.description = _description;
children= new ArrayList<Category>();
}
/**
* @param _name Category name
*/
public Category(String _name) {
this(null, null, _name);
public Category(String _name, String _description) {
this(null, null, _name, _description);
}
@Override
@ -138,8 +140,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.name.toLowerCase());
return Messages.format(FormatterMessages.LineWrappingTabPage_multi_group, new String[] {category.name.toLowerCase(), Integer.toString(fSelectionState.getElements().size())});
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_multiple_selections, new String[] {Integer.toString(fSelectionState.getElements().size())});
}
@ -362,14 +364,16 @@ public class LineWrappingTabPage extends FormatterTabPage {
// " if (argument==0) return 0;" + //$NON-NLS-1$
// " if (argument==1) return 42; else return 43;" + //$NON-NLS-1$
// "}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_compact_if_else
// FormatterMessages.LineWrappingTabPage_compact_if_else,
// FormatterMessages.LineWrappingTabPage_compact_if_else_lowercase
// );
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
FormatterMessages.LineWrappingTabPage_base_clause,
FormatterMessages.LineWrappingTabPage_base_clause_lowercase
);
@ -377,20 +381,23 @@ public class LineWrappingTabPage extends FormatterTabPage {
// 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$
// "Example() {}}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_parameters
// FormatterMessages.LineWrappingTabPage_parameters,
// FormatterMessages.LineWrappingTabPage_parameters_lowercase
// );
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,
FormatterMessages.LineWrappingTabPage_parameters_lowercase
);
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,
FormatterMessages.LineWrappingTabPage_arguments_lowercase
);
private final Category fMethodThrowsClauseCategory= new Category(
@ -398,7 +405,8 @@ public class LineWrappingTabPage extends FormatterTabPage {
"class Example {" + //$NON-NLS-1$
"int foo() throw(FirstException, SecondException, ThirdException) {" + //$NON-NLS-1$
" return Other::doSomething();}};", //$NON-NLS-1$
FormatterMessages.LineWrappingTabPage_throws_clause
FormatterMessages.LineWrappingTabPage_throws_clause,
FormatterMessages.LineWrappingTabPage_throws_clause_lowercase
);
// private final Category fConstructorThrowsClauseCategory= new Category(
@ -407,6 +415,7 @@ public class LineWrappingTabPage extends FormatterTabPage {
// "Example() throws FirstException, SecondException, ThirdException {" + //$NON-NLS-1$
// " return Other.doSomething();}}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_throws_clause
// FormatterMessages.LineWrappingTabPage_throws_clause_lowercase
// );
//
//
@ -414,24 +423,28 @@ 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
// FormatterMessages.LineWrappingTabPage_object_allocation_lowercase
// );
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,
FormatterMessages.LineWrappingTabPage_initializer_list_lowercase
);
// private final Category fExplicitConstructorArgumentsCategory= new Category(
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_EXPLICIT_CONSTRUCTOR_CALL,
// "class Example extends AnotherClass {Example() {super(100, 200, 300, 400, 500, 600, 700);}}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_explicit_constructor_invocations
// FormatterMessages.LineWrappingTabPage_explicit_constructor_invocations_lowercase
// );
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,
FormatterMessages.LineWrappingTabPage_conditionals_lowercase
);
// private final Category fBinaryExpressionCategory= new Category(
@ -442,28 +455,32 @@ public class LineWrappingTabPage extends FormatterTabPage {
// " int product= 1 * 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10;" + //$NON-NLS-1$
// " boolean val= true && false && true && false && true;" + //$NON-NLS-1$
// " return product / sum;}}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_binary_exprs
// FormatterMessages.LineWrappingTabPage_binary_exprs,
// FormatterMessages.LineWrappingTabPage_binary_exprs_lowercase
// );
//
// private final Category fEnumConstArgumentsCategory= new Category(
// DefaultCodeFormatterConstants.FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT,
// "enum Example {" + //$NON-NLS-1$
// "GREEN(0, 255, 0), RED(255, 0, 0) }", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_enum_constant_arguments
// 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$
// "}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_enum_superinterfaces
// 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$
"CANCELLED, RUNNING, WAITING, FINISHED };", //$NON-NLS-1$
FormatterMessages.LineWrappingTabPage_enumerator_list
FormatterMessages.LineWrappingTabPage_enumerator_list,
FormatterMessages.LineWrappingTabPage_enumerator_list_lowercase
);
//
// private final Category fAssignmentCategory= new Category(
@ -474,7 +491,8 @@ public class LineWrappingTabPage extends FormatterTabPage {
// "for (int i = 0; i < 10; i++) {}" + //$NON-NLS-1$
// "String s;" + //$NON-NLS-1$
// "s = \"TextTextText\";}}", //$NON-NLS-1$
// FormatterMessages.LineWrappingTabPage_assignment_alignment
// FormatterMessages.LineWrappingTabPage_assignment_alignment,
// FormatterMessages.LineWrappingTabPage_assignment_alignment_lowercase
// );
/**
@ -558,30 +576,30 @@ public class LineWrappingTabPage extends FormatterTabPage {
*/
protected List<Category> createCategories() {
final Category classDeclarations= new Category(FormatterMessages.LineWrappingTabPage_class_decls);
final Category classDeclarations= new Category(FormatterMessages.LineWrappingTabPage_class_decls,FormatterMessages.LineWrappingTabPage_class_decls_lowercase);
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);
final Category methodDeclarations= new Category(null, null, FormatterMessages.LineWrappingTabPage_method_decls,FormatterMessages.LineWrappingTabPage_method_decls_lowercase);
methodDeclarations.children.add(fMethodDeclarationsParametersCategory);
methodDeclarations.children.add(fMethodThrowsClauseCategory);
final Category enumDeclarations= new Category(FormatterMessages.LineWrappingTabPage_enum_decls);
final Category enumDeclarations= new Category(FormatterMessages.LineWrappingTabPage_enum_decls,FormatterMessages.LineWrappingTabPage_enum_decls_lowercase);
enumDeclarations.children.add(fEnumeratorsCategory);
// enumDeclarations.children.add(fEnumDeclInterfacesCategory);
// enumDeclarations.children.add(fEnumConstArgumentsCategory);
final Category functionCalls= new Category(FormatterMessages.LineWrappingTabPage_function_calls);
final Category functionCalls= new Category(FormatterMessages.LineWrappingTabPage_function_calls,FormatterMessages.LineWrappingTabPage_function_calls_lowercase);
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);
final Category expressions= new Category(FormatterMessages.LineWrappingTabPage_expressions,FormatterMessages.LineWrappingTabPage_expressions_lowercase);
// expressions.children.add(fBinaryExpressionCategory);
expressions.children.add(fConditionalExpressionCategory);
expressions.children.add(fInitializerListExpressionsCategory);