Bug 72046 Add new options in the code formatter preference page [code formatter]
Adding the new 1.5 constructs in the code formatter led to the additions of the following constants: FORMATTER_ALIGNMENT_FOR_ARGUMENTS_IN_ENUM_CONSTANT FORMATTER_ALIGNMENT_FOR_SUPERINTERFACES_IN_ENUM_DECLARATION FORMATTER_BRACE_POSITION_FOR_ANNOTATION_TYPE_DECLARATION FORMATTER_BRACE_POSITION_FOR_ENUM_CONSTANT FORMATTER_BRACE_POSITION_FOR_ENUM_DECLARATION FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_CONSTANT_HEADER FORMATTER_INDENT_BODY_DECLARATIONS_COMPARE_TO_ENUM_DECLARATION_HEADER FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_CONSTANT FORMATTER_INSERT_NEW_LINE_IN_EMPTY_ENUM_DECLARATION FORMATTER_INSERT_SPACE_AFTER_AND_IN_WILDCARD FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION FORMATTER_INSERT_SPACE_AFTER_AT_IN_ANNOTATION_TYPE_DECLARATION FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_AFTER_COLON_IN_FOR FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ANNOTATION FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_CONSTANT_ARGUMENTS FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ENUM_DECLARATIONS FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ANNOTATION FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_ENUM_CONSTANT FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_WILDCARD FORMATTER_INSERT_SPACE_BEFORE_AND_IN_WILDCARD FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ANNOTATION_TYPE_MEMBER_DECLARATION FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_ENUM_CONSTANT They need to be added in the code formatter preference page.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/formatter/WhiteSpaceOptions.java
final InnerNode forStatement= createChild(parent, workingValues, "WhiteSpaceOptions.for");  
        createOption(forStatement, workingValues, "WhiteSpaceOptions.initialization", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, FOR_PREVIEW); 
        createOption(forStatement, workingValues, "WhiteSpaceOptions.incrementation", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW); 
            
        final InnerNode invocation= createChild(parent, workingValues, "WhiteSpaceOptions.arguments");  
        createOption(invocation, workingValues, "WhiteSpaceOptions.method_call", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW); 
        createOption(invocation, workingValues, "WhiteSpaceOptions.explicit_constructor_call", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, CONSTRUCTOR_DECL_PREVIEW); 
        createOption(invocation, workingValues, "WhiteSpaceOptions.alloc_expr", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW); 
        final InnerNode decl= createChild(parent, workingValues, "WhiteSpaceOptions.parameters"); 
        createOption(decl, workingValues, "WhiteSpaceOptions.constructor", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW); 
        createOption(decl, workingValues, "WhiteSpaceOptions.method", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW); 
        final InnerNode throwsDecl= createChild(parent, workingValues, "WhiteSpaceOptions.throws");  
        createOption(throwsDecl, workingValues, "WhiteSpaceOptions.constructor", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW); 
        createOption(throwsDecl, workingValues, "WhiteSpaceOptions.method", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW); 
        
        final InnerNode multDecls= createChild(parent, workingValues, "WhiteSpaceOptions.mult_decls"); 
        createOption(multDecls, workingValues, "WhiteSpaceOptions.fields", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, MULT_FIELD_PREVIEW); 
        createOption(multDecls, workingValues, "WhiteSpaceOptions.local_vars", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, MULT_LOCAL_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.initializer", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER, ARRAY_DECL_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.implements_clause", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES, CLASS_DECL_PREVIEW); 
    }
    private static void createBeforeOperatorTree(Map workingValues, final InnerNode parent) {
        createOption(parent, workingValues, "WhiteSpaceOptions.assignment_operator", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.unary_operator", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, OPERATOR_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.binary_operator", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, OPERATOR_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.prefix_operator", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, OPERATOR_PREVIEW); 
        createOption(parent, workingValues, "WhiteSpaceOptions.postfix_operator", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, OPERATOR_PREVIEW); 
    }
    private static void createBeforeClosingBracketTree(Map workingValues, final InnerNode parent) {
        createOption(parent, workingValues, "WhiteSpaceOptions.array_alloc", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, ARRAY_DECL_PREVIEW);