1 /*******************************************************************************
2 * Copyright (c) 2000, 2008 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 * Anton Leherbauer (Wind River Systems)
11 *******************************************************************************/
13 package org.eclipse.cdt.internal.ui.preferences.formatter;
15 import java.util.ArrayList;
16 import java.util.Collections;
17 import java.util.List;
20 import org.eclipse.cdt.core.CCorePlugin;
21 import org.eclipse.cdt.core.formatter.CodeFormatter;
22 import org.eclipse.cdt.core.formatter.DefaultCodeFormatterConstants;
24 import org.eclipse.cdt.internal.ui.preferences.formatter.SnippetPreview.PreviewSnippet;
28 * Manage code formatter white space options on a higher level.
30 public final class WhiteSpaceOptions {
33 * Represents a node in the options tree.
35 public abstract static class Node {
37 private final InnerNode fParent;
38 private final String fName;
42 protected final Map<String,String> fWorkingValues;
43 protected final ArrayList<Node> fChildren;
45 public Node(InnerNode parent, Map<String,String> workingValues, String message) {
46 if (workingValues == null || message == null)
47 throw new IllegalArgumentException();
49 fWorkingValues= workingValues;
51 fChildren= new ArrayList<Node>();
56 public abstract void setChecked(boolean checked);
58 public boolean hasChildren() {
59 return !fChildren.isEmpty();
62 public List<Node> getChildren() {
63 return Collections.unmodifiableList(fChildren);
66 public InnerNode getParent() {
71 public final String toString() {
75 public abstract List<PreviewSnippet> getSnippets();
77 public abstract void getCheckedLeafs(List<OptionNode> list);
81 * A node representing a group of options in the tree.
83 public static class InnerNode extends Node {
85 public InnerNode(InnerNode parent, Map<String,String> workingValues, String messageKey) {
86 super(parent, workingValues, messageKey);
90 public void setChecked(boolean checked) {
91 for (Object element : fChildren)
92 ((Node)element).setChecked(checked);
95 public void add(Node child) {
100 public List<PreviewSnippet> getSnippets() {
101 final ArrayList<PreviewSnippet> snippets= new ArrayList<PreviewSnippet>(fChildren.size());
102 for (Object element : fChildren) {
103 final List<PreviewSnippet> childSnippets= ((Node)element).getSnippets();
104 for (PreviewSnippet snippet : childSnippets) {
105 if (!snippets.contains(snippet))
106 snippets.add(snippet);
113 public void getCheckedLeafs(List<OptionNode> list) {
114 for (Node element : fChildren) {
115 element.getCheckedLeafs(list);
122 * A node representing a concrete white space option in the tree.
124 public static class OptionNode extends Node {
125 private final String fKey;
126 private final ArrayList<PreviewSnippet> fSnippets;
128 public OptionNode(InnerNode parent, Map<String, String> workingValues, String messageKey, String key, PreviewSnippet snippet) {
129 super(parent, workingValues, messageKey);
131 fSnippets= new ArrayList<PreviewSnippet>(1);
132 fSnippets.add(snippet);
136 public void setChecked(boolean checked) {
137 fWorkingValues.put(fKey, checked ? CCorePlugin.INSERT : CCorePlugin.DO_NOT_INSERT);
140 public boolean getChecked() {
141 return CCorePlugin.INSERT.equals(fWorkingValues.get(fKey));
145 public List<PreviewSnippet> getSnippets() {
150 public void getCheckedLeafs(List<OptionNode> list) {
162 private final PreviewSnippet FOR_PREVIEW= new PreviewSnippet(
163 CodeFormatter.K_STATEMENTS,
164 "for (int i= 0, j= argc; i < argc; i++, j--) {}" //$NON-NLS-1$
167 private final PreviewSnippet WHILE_PREVIEW= new PreviewSnippet(
168 CodeFormatter.K_STATEMENTS,
169 "while (condition) {} do {} while (condition);" //$NON-NLS-1$
172 private final PreviewSnippet CATCH_PREVIEW= new PreviewSnippet(
173 CodeFormatter.K_STATEMENTS,
174 "try { number= Math::parseInt(value); } catch (Math::Exception e) {}"); //$NON-NLS-1$
176 private final PreviewSnippet IF_PREVIEW= new PreviewSnippet(
177 CodeFormatter.K_STATEMENTS,
178 "if (condition) { return foo; } else {return bar;}"); //$NON-NLS-1$
180 private final PreviewSnippet SWITCH_PREVIEW= new PreviewSnippet(
181 CodeFormatter.K_STATEMENTS,
182 "switch (number) { case RED: return GREEN; case GREEN: return BLUE; case BLUE: return RED; default: return BLACK;}"); //$NON-NLS-1$
184 private final PreviewSnippet METHOD_DECL_PREVIEW= new PreviewSnippet(
185 CodeFormatter.K_CLASS_BODY_DECLARATIONS,
186 "void foo() throw(E0, E1) {}" + //$NON-NLS-1$
187 "void bar(int x, int y) throw() {}"); //$NON-NLS-1$
189 private final PreviewSnippet INITIALIZER_LIST_PREVIEW= new PreviewSnippet(
190 CodeFormatter.K_STATEMENTS,
191 "int array[]= {1, 2, 3};"); //$NON-NLS-1$
193 private final PreviewSnippet ARRAY_PREVIEW= new PreviewSnippet(
194 CodeFormatter.K_STATEMENTS,
195 "int array[]= {1, 2, 3};\n" + //$NON-NLS-1$
196 "array [2] = 0;\n" + //$NON-NLS-1$
197 "int * parray= new int[3];" + //$NON-NLS-1$
198 "delete[] parray;"); //$NON-NLS-1$
200 private final PreviewSnippet METHOD_CALL_PREVIEW= new PreviewSnippet(
201 CodeFormatter.K_STATEMENTS,
202 "foo();\n" + //$NON-NLS-1$
203 "bar(x, y);"); //$NON-NLS-1$
205 private final PreviewSnippet LABEL_PREVIEW= new PreviewSnippet(
206 CodeFormatter.K_STATEMENTS,
207 "label: for (int i= 0; i<argc; i++) goto label;"); //$NON-NLS-1$
209 private final PreviewSnippet SEMICOLON_PREVIEW= new PreviewSnippet(
210 CodeFormatter.K_STATEMENTS,
211 "int a= 4; foo(); bar(x, y);"); //$NON-NLS-1$
213 private final PreviewSnippet CONDITIONAL_PREVIEW= new PreviewSnippet(
214 CodeFormatter.K_TRANSLATION_UNIT,
215 "bool value= condition ? true : false;"); //$NON-NLS-1$
217 private final PreviewSnippet CLASS_DECL_PREVIEW= new PreviewSnippet(
218 CodeFormatter.K_TRANSLATION_UNIT,
219 "class MyClass : Base1, Base2 {};"); //$NON-NLS-1$
221 private final PreviewSnippet OPERATOR_PREVIEW= new PreviewSnippet(
222 CodeFormatter.K_STATEMENTS,
223 "int a= -4 + -9; b= a++ / --number; c += 4; bool value= true && false;"); //$NON-NLS-1$
225 private final PreviewSnippet CAST_PREVIEW= new PreviewSnippet(
226 CodeFormatter.K_STATEMENTS,
227 "char * s= ((char *)object);"); //$NON-NLS-1$
229 private final PreviewSnippet EXPRESSION_LIST_PREVIEW= new PreviewSnippet(
230 CodeFormatter.K_STATEMENTS,
231 "a= 0, b= 1, c= 2, d= 3;"); //$NON-NLS-1$
233 private final PreviewSnippet DECLARATOR_LIST_PREVIEW= new PreviewSnippet(
234 CodeFormatter.K_STATEMENTS,
235 "int a=0,b=1,c=2,d=3;"); //$NON-NLS-1$
237 private final PreviewSnippet BLOCK_PREVIEW= new PreviewSnippet(
238 CodeFormatter.K_STATEMENTS,
239 "if (true) { return 1; } else { return 2; }"); //$NON-NLS-1$
241 private final PreviewSnippet PAREN_EXPR_PREVIEW= new PreviewSnippet(
242 CodeFormatter.K_STATEMENTS,
243 "result= (a *( b + c + d) * (e + f));"); //$NON-NLS-1$
245 private final PreviewSnippet TEMPLATES_PREVIEW= new PreviewSnippet(
246 CodeFormatter.K_TRANSLATION_UNIT,
247 "template<typename T1,typename T2> class map {};\n" + //$NON-NLS-1$
248 "map<int,int> m;" //$NON-NLS-1$
252 * Create the tree, in this order: syntax element - position - abstract element
253 * @param workingValues
254 * @return returns roots (type <code>Node</code>)
256 public List<InnerNode> createTreeBySyntaxElem(Map<String, String> workingValues) {
257 final ArrayList<InnerNode> roots= new ArrayList<InnerNode>();
261 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_paren);
262 createBeforeOpenParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
263 createAfterOpenParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
266 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_paren);
267 createBeforeClosingParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
268 createAfterCloseParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
271 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_brace);
272 createBeforeOpenBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
273 createAfterOpenBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
276 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_brace);
277 createBeforeClosingBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
278 createAfterCloseBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
281 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_bracket);
282 createBeforeOpenBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
283 createAfterOpenBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
286 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_bracket);
287 createBeforeClosingBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
290 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_operator);
291 createBeforeOperatorTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
292 createAfterOperatorTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
295 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_comma);
296 createBeforeCommaTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
297 createAfterCommaTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
300 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_colon);
301 createBeforeColonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
302 createAfterColonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
305 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_semicolon);
306 createBeforeSemicolonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
307 createAfterSemicolonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
310 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_question_mark);
311 createBeforeQuestionTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
312 createAfterQuestionTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
315 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_parens);
316 createBetweenEmptyParenTree(workingValues, element);
319 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_braces);
320 createBetweenEmptyBracesTree(workingValues, element);
323 element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_brackets);
324 createBetweenEmptyBracketsTree(workingValues, element);
331 * Create the tree, in this order: position - syntax element - abstract
333 * @param workingValues
334 * @return returns roots (type <code>Node</code>)
336 public List<InnerNode> createAltTree(Map<String, String> workingValues) {
338 final ArrayList<InnerNode> roots= new ArrayList<InnerNode>();
342 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_paren);
343 createBeforeOpenParenTree(workingValues, parent);
345 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_paren);
346 createAfterOpenParenTree(workingValues, parent);
348 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_paren);
349 createBeforeClosingParenTree(workingValues, parent);
351 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_paren);
352 createAfterCloseParenTree(workingValues, parent);
354 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_parens);
355 createBetweenEmptyParenTree(workingValues, parent);
357 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_brace);
358 createBeforeOpenBraceTree(workingValues, parent);
360 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_brace);
361 createAfterOpenBraceTree(workingValues, parent);
363 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_brace);
364 createBeforeClosingBraceTree(workingValues, parent);
366 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_brace);
367 createAfterCloseBraceTree(workingValues, parent);
369 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_braces);
370 createBetweenEmptyBracesTree(workingValues, parent);
372 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_bracket);
373 createBeforeOpenBracketTree(workingValues, parent);
375 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_bracket);
376 createAfterOpenBracketTree(workingValues, parent);
378 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_bracket);
379 createBeforeClosingBracketTree(workingValues, parent);
381 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_brackets);
382 createBetweenEmptyBracketsTree(workingValues, parent);
384 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_angle_bracket);
385 createBeforeOpenAngleBracketTree(workingValues, parent);
387 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_angle_bracket);
388 createAfterOpenAngleBracketTree(workingValues, parent);
390 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_angle_bracket);
391 createBeforeClosingAngleBracketTree(workingValues, parent);
393 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_angle_bracket);
394 createAfterClosingAngleBracketTree(workingValues, parent);
397 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_operator);
398 createBeforeOperatorTree(workingValues, parent);
400 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_operator);
401 createAfterOperatorTree(workingValues, parent);
403 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_comma);
404 createBeforeCommaTree(workingValues, parent);
406 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_comma);
407 createAfterCommaTree(workingValues, parent);
409 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_colon);
410 createAfterColonTree(workingValues, parent);
412 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_colon);
413 createBeforeColonTree(workingValues, parent);
415 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_semicolon);
416 createBeforeSemicolonTree(workingValues, parent);
418 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_semicolon);
419 createAfterSemicolonTree(workingValues, parent);
421 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_question_mark);
422 createBeforeQuestionTree(workingValues, parent);
424 parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_question_mark);
425 createAfterQuestionTree(workingValues, parent);
427 // parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_ellipsis);
428 // createBeforeEllipsis(workingValues, parent);
430 // parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_ellipsis);
431 // createAfterEllipsis(workingValues, parent);
436 private InnerNode createParentNode(List<InnerNode> roots, Map<String, String> workingValues, String text) {
437 final InnerNode parent= new InnerNode(null, workingValues, text);
442 public ArrayList<InnerNode> createTreeByCElement(Map<String, String> workingValues) {
444 final InnerNode declarations= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_declarations);
445 createClassTree(workingValues, declarations);
446 createDeclaratorListTree(workingValues, declarations);
447 // createConstructorTree(workingValues, declarations);
448 createMethodDeclTree(workingValues, declarations);
449 createExceptionSpecificationTree(workingValues, declarations);
450 createLabelTree(workingValues, declarations);
452 final InnerNode statements= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_statements);
453 createOption(statements, workingValues, FormatterMessages.WhiteSpaceOptions_before_semicolon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, SEMICOLON_PREVIEW);
454 createBlockTree(workingValues, statements);
455 createIfStatementTree(workingValues, statements);
456 createForStatementTree(workingValues, statements);
457 createSwitchStatementTree(workingValues, statements);
458 createDoWhileTree(workingValues, statements);
459 createTryStatementTree(workingValues, statements);
460 // createReturnTree(workingValues, statements);
461 // createThrowTree(workingValues, statements);
463 final InnerNode expressions= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_expressions);
464 createFunctionCallTree(workingValues, expressions);
465 createAssignmentTree(workingValues, expressions);
466 createInitializerListTree(workingValues, expressions);
467 createOperatorTree(workingValues, expressions);
468 createParenthesizedExpressionTree(workingValues, expressions);
469 createTypecastTree(workingValues, expressions);
470 createConditionalTree(workingValues, expressions);
471 createExpressionListTree(workingValues, expressions);
473 final InnerNode arrays= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_arrays);
474 createArrayTree(workingValues, arrays);
476 final InnerNode templates= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_templates);
477 createTemplateArgumentTree(workingValues, templates);
478 createTemplateParameterTree(workingValues, templates);
480 final ArrayList<InnerNode> roots= new ArrayList<InnerNode>();
481 roots.add(declarations);
482 roots.add(statements);
483 roots.add(expressions);
485 roots.add(templates);
489 private void createBeforeQuestionTree(Map<String, String> workingValues, final InnerNode parent) {
490 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
493 private void createBeforeSemicolonTree(Map<String, String> workingValues, final InnerNode parent) {
494 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR, FOR_PREVIEW);
495 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_statements, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, SEMICOLON_PREVIEW);
498 private void createBeforeColonTree(Map<String, String> workingValues, final InnerNode parent) {
499 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
500 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_label, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT, LABEL_PREVIEW);
501 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_base_clause, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_BASE_CLAUSE, CLASS_DECL_PREVIEW);
503 final InnerNode switchStatement= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch);
504 createOption(switchStatement, workingValues, FormatterMessages.WhiteSpaceOptions_case, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE, SWITCH_PREVIEW);
505 createOption(switchStatement, workingValues, FormatterMessages.WhiteSpaceOptions_default, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT, SWITCH_PREVIEW);
508 private void createBeforeCommaTree(Map<String, String> workingValues, final InnerNode parent) {
510 // final InnerNode forStatement= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for);
511 // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_initialization, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, FOR_PREVIEW);
512 // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_incrementation, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW);
514 final InnerNode invocation= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arguments);
515 createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW);
516 createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
518 final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameters);
519 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW);
520 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
522 final InnerNode lists= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_lists);
523 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_declarator_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW);
524 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_expression_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW);
525 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
527 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW);
530 private void createBeforeOperatorTree(Map<String, String> workingValues, final InnerNode parent) {
531 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_assignment_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW);
532 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_unary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, OPERATOR_PREVIEW);
533 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_binary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, OPERATOR_PREVIEW);
534 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_prefix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, OPERATOR_PREVIEW);
535 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_postfix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, OPERATOR_PREVIEW);
538 private void createBeforeClosingBracketTree(Map<String, String> workingValues, final InnerNode parent) {
539 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arrays, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET, ARRAY_PREVIEW);
542 private void createBeforeClosingAngleBracketTree(Map<String, String> workingValues, final InnerNode parent) {
543 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
544 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
548 private void createBeforeOpenBracketTree(Map<String, String> workingValues, final InnerNode parent) {
549 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arrays, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET, ARRAY_PREVIEW);
552 private void createBeforeOpenAngleBracketTree(Map<String, String> workingValues, final InnerNode parent) {
553 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
554 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
557 private void createBeforeClosingBraceTree(Map<String, String> workingValues, final InnerNode parent) {
558 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_INITIALIZER_LIST, CLASS_DECL_PREVIEW);
561 private void createBeforeOpenBraceTree(Map<String, String> workingValues, final InnerNode parent) {
563 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_class_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, CLASS_DECL_PREVIEW);
565 final InnerNode functionDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); {
566 createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
569 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
570 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK, BLOCK_PREVIEW);
571 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, SWITCH_PREVIEW);
574 private void createBeforeClosingParenTree(Map<String, String> workingValues, final InnerNode parent) {
576 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH, CATCH_PREVIEW);
577 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, FOR_PREVIEW);
578 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_if, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, IF_PREVIEW);
579 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
580 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE, WHILE_PREVIEW);
582 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, CAST_PREVIEW);
584 final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration);
585 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
586 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
588 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
589 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
592 private void createBeforeOpenParenTree(Map<String, String> workingValues, final InnerNode parent) {
594 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH, CATCH_PREVIEW);
595 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, FOR_PREVIEW);
596 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_if, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, IF_PREVIEW);
597 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
598 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW);
599 // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_return_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, RETURN_PREVIEW);
600 // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throw_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, THROW_PREVIEW);
602 final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration);
603 createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
604 createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
606 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
607 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
610 private void createAfterQuestionTree(Map<String, String> workingValues, final InnerNode parent) {
611 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
614 // private void createBeforeEllipsis(Map workingValues, InnerNode parent) {
615 // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_vararg_parameter, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ELLIPSIS, VARARG_PARAMETER_PREVIEW);
618 // private void createAfterEllipsis(Map workingValues, InnerNode parent) {
619 // createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_vararg_parameter, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ELLIPSIS, VARARG_PARAMETER_PREVIEW);
622 private void createAfterSemicolonTree(Map<String, String> workingValues, final InnerNode parent) {
623 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR, FOR_PREVIEW);
626 private void createAfterColonTree(Map<String, String> workingValues, final InnerNode parent) {
627 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
628 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_label, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT, LABEL_PREVIEW);
629 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_base_clause, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_BASE_CLAUSE, CLASS_DECL_PREVIEW);
632 private void createAfterCommaTree(Map<String, String> workingValues, final InnerNode parent) {
634 // final InnerNode forStatement= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for); {
635 // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_initialization, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS, FOR_PREVIEW);
636 // createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_incrementation, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW);
638 final InnerNode invocation= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arguments); {
639 createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW);
640 createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
642 final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameters); {
643 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW);
644 createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
646 final InnerNode lists= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_lists); {
647 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_declarator_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW);
648 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_expression_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW);
649 createOption(lists, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
652 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW);
655 private void createAfterOperatorTree(Map<String, String> workingValues, final InnerNode parent) {
657 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_assignment_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW);
658 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_unary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR, OPERATOR_PREVIEW);
659 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_binary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR, OPERATOR_PREVIEW);
660 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_prefix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, OPERATOR_PREVIEW);
661 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_postfix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR, OPERATOR_PREVIEW);
664 private void createAfterOpenBracketTree(Map<String, String> workingValues, final InnerNode parent) {
665 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arrays, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET, ARRAY_PREVIEW);
668 private void createAfterOpenAngleBracketTree(Map<String, String> workingValues, final InnerNode parent) {
669 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
670 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
675 private void createAfterOpenBraceTree(Map<String, String> workingValues, final InnerNode parent) {
677 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
680 private void createAfterCloseBraceTree(Map<String, String> workingValues, final InnerNode parent) {
681 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, BLOCK_PREVIEW);
684 private void createAfterCloseParenTree(Map<String, String> workingValues, final InnerNode parent) {
686 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST, CAST_PREVIEW);
689 private void createAfterClosingAngleBracketTree(Map<String, String> workingValues, final InnerNode parent) {
690 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
691 //createOption(parent, workingValues, "WhiteSpaceOptions.parameterized_type", DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, TYPE_ARGUMENTS_PREVIEW); //$NON-NLS-1$
692 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_template_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
695 private void createAfterOpenParenTree(Map<String, String> workingValues, final InnerNode parent) {
696 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH, CATCH_PREVIEW);
697 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, FOR_PREVIEW);
698 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_if, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, IF_PREVIEW);
699 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
700 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW);
702 final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_declaration); {
703 createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_function, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
704 createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
706 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST, CAST_PREVIEW);
707 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
708 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
711 private void createBetweenEmptyParenTree(Map<String, String> workingValues, final InnerNode parent) {
713 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
714 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_function_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
715 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_exception_specification, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION, METHOD_CALL_PREVIEW);
718 private void createBetweenEmptyBracketsTree(Map<String, String> workingValues, final InnerNode parent) {
719 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arrays, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS, ARRAY_PREVIEW);
722 private void createBetweenEmptyBracesTree(Map<String, String> workingValues, final InnerNode parent) {
723 createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer_list, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
726 // syntax element tree
728 private InnerNode createClassTree(Map<String, String> workingValues, InnerNode parent) {
729 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_classes);
730 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_classes_before_opening_brace_of_a_class, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, CLASS_DECL_PREVIEW);
731 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_classes_before_colon_of_base_clause, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_BASE_CLAUSE, CLASS_DECL_PREVIEW);
732 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_classes_after_colon_of_base_clause, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_BASE_CLAUSE, CLASS_DECL_PREVIEW);
733 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_classes_before_comma_base_types, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_BASE_TYPES, CLASS_DECL_PREVIEW);
734 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_classes_after_comma_base_types, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_BASE_TYPES, CLASS_DECL_PREVIEW);
738 private InnerNode createAssignmentTree(Map<String, String> workingValues, InnerNode parent) {
739 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_assignments);
740 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_assignments_before_assignment_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW);
741 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_assignments_after_assignment_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW);
745 private InnerNode createOperatorTree(Map<String, String> workingValues, InnerNode parent) {
746 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_operators);
748 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_before_binary_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, OPERATOR_PREVIEW);
749 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_after_binary_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_BINARY_OPERATOR, OPERATOR_PREVIEW);
750 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_before_unary_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, OPERATOR_PREVIEW);
751 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_after_unary_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_UNARY_OPERATOR, OPERATOR_PREVIEW);
752 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_before_prefix_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, OPERATOR_PREVIEW);
753 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_after_prefix_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_PREFIX_OPERATOR, OPERATOR_PREVIEW);
754 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_before_postfix_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, OPERATOR_PREVIEW);
755 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_operators_after_postfix_operators, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_POSTFIX_OPERATOR, OPERATOR_PREVIEW);
759 private InnerNode createMethodDeclTree(Map<String, String> workingValues, InnerNode parent) {
760 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_functions);
762 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
763 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
764 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
765 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
766 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
768 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW);
769 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW);
773 private InnerNode createExceptionSpecificationTree(Map<String, String> workingValues, InnerNode parent) {
774 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_exception_specifications);
776 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
777 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
778 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
779 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_EXCEPTION_SPECIFICATION, METHOD_DECL_PREVIEW);
781 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW);
782 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma_in_params, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW);
786 private InnerNode createDeclaratorListTree(Map<String, String> workingValues, InnerNode parent) {
787 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list);
789 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list_before_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW);
790 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_declarator_list_after_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_DECLARATOR_LIST, DECLARATOR_LIST_PREVIEW);
794 private InnerNode createExpressionListTree(Map<String, String> workingValues, InnerNode parent) {
795 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_expression_list);
796 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_expression_list_before_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW);
797 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_expression_list_after_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_EXPRESSION_LIST, EXPRESSION_LIST_PREVIEW);
801 private InnerNode createInitializerListTree(Map<String, String> workingValues, InnerNode parent) {
802 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_initializer_list);
804 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
805 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
806 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
807 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
808 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
809 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_braces, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACES_IN_INITIALIZER_LIST, INITIALIZER_LIST_PREVIEW);
813 private InnerNode createArrayTree(Map<String, String> workingValues, InnerNode parent) {
814 createOption(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET, ARRAY_PREVIEW);
815 createOption(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACKET, ARRAY_PREVIEW);
816 createOption(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET, ARRAY_PREVIEW);
817 createOption(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_brackets, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_BRACKETS, ARRAY_PREVIEW);
821 private InnerNode createFunctionCallTree(Map<String, String> workingValues, InnerNode parent) {
822 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_calls);
824 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
825 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
826 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
827 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_between_empty_parens, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BETWEEN_EMPTY_PARENS_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
828 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_before_comma_in_function_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW);
829 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_after_comma_in_function_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW);
830 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_before_comma_in_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW);
831 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_calls_after_comma_in_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW);
835 private InnerNode createBlockTree(Map<String, String> workingValues, InnerNode parent) {
836 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_blocks);
838 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK, BLOCK_PREVIEW);
839 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_closing_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_BRACE_IN_BLOCK, BLOCK_PREVIEW);
843 private InnerNode createSwitchStatementTree(Map<String, String> workingValues, InnerNode parent) {
844 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_switch);
846 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_switch_before_case_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE, SWITCH_PREVIEW);
847 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_switch_before_default_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT, SWITCH_PREVIEW);
848 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_brace, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, SWITCH_PREVIEW);
849 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
850 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
851 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
855 private InnerNode createDoWhileTree(Map<String, String> workingValues, InnerNode parent) {
856 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_do);
858 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW);
859 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW);
860 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE, WHILE_PREVIEW);
865 private InnerNode createTryStatementTree(Map<String, String> workingValues, InnerNode parent) {
866 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_try);
868 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH, CATCH_PREVIEW);
869 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CATCH, CATCH_PREVIEW);
870 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH, CATCH_PREVIEW);
873 private InnerNode createIfStatementTree(Map<String, String> workingValues, InnerNode parent) {
874 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_if);
876 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, IF_PREVIEW);
877 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_IF, IF_PREVIEW);
878 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, IF_PREVIEW);
882 private InnerNode createForStatementTree(Map<String, String> workingValues, InnerNode parent) {
883 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_for);
885 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, FOR_PREVIEW);
886 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_FOR, FOR_PREVIEW);
887 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, FOR_PREVIEW);
888 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_for_before_comma_init, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, FOR_PREVIEW);
889 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_for_after_comma_init, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INITS, FOR_PREVIEW);
890 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_for_before_comma_inc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW);
891 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_for_after_comma_inc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW);
892 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_semicolon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR, FOR_PREVIEW);
893 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_semicolon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR, FOR_PREVIEW);
898 // private InnerNode createReturnTree(Map workingValues, InnerNode parent) {
899 // final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceOptions_return);
900 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_parenthesized_expressions, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, RETURN_PREVIEW);
904 // private InnerNode createThrowTree(Map workingValues, InnerNode parent) {
905 // final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throw);
906 // createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_parenthesized_expressions, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, THROW_PREVIEW);
910 private InnerNode createLabelTree(Map<String, String> workingValues, InnerNode parent) {
911 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_labels);
912 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT, LABEL_PREVIEW);
913 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_LABELED_STATEMENT, LABEL_PREVIEW);
917 private InnerNode createTemplateArgumentTree(Map<String, String> workingValues, InnerNode parent) {
918 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_template_arguments);
919 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
920 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
921 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
922 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
923 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
924 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_closing_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_ARGUMENTS, TEMPLATES_PREVIEW);
928 private InnerNode createTemplateParameterTree(Map<String, String> workingValues, InnerNode parent) {
929 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_template_parameters);
930 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
931 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
932 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
933 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_comma, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
934 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
935 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_closing_angle_bracket, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_ANGLE_BRACKET_IN_TEMPLATE_PARAMETERS, TEMPLATES_PREVIEW);
939 private InnerNode createConditionalTree(Map<String, String> workingValues, InnerNode parent) {
940 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_conditionals);
942 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_question, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
943 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_question, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_QUESTION_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
944 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
945 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_colon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_COLON_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
950 private InnerNode createTypecastTree(Map<String, String> workingValues, InnerNode parent) {
951 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_typecasts);
953 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_CAST, CAST_PREVIEW);
954 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, CAST_PREVIEW);
955 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_CLOSING_PAREN_IN_CAST, CAST_PREVIEW);
960 private InnerNode createParenthesizedExpressionTree(Map<String, String> workingValues, InnerNode parent) {
961 final InnerNode root= new InnerNode(parent, workingValues, FormatterMessages.WhiteSpaceTabPage_parenexpr);
963 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
964 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_after_opening_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
965 createOption(root, workingValues, FormatterMessages.WhiteSpaceTabPage_before_closing_paren, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
971 private static InnerNode createChild(InnerNode root, Map<String, String> workingValues, String message) {
972 return new InnerNode(root, workingValues, message);
975 private static OptionNode createOption(InnerNode root, Map<String, String> workingValues, String message, String key, PreviewSnippet snippet) {
976 return new OptionNode(root, workingValues, message, key, snippet);
979 public static void makeIndexForNodes(List<? extends Node> tree, List<Node> flatList) {
980 for (Node node : tree) {
981 node.index= flatList.size();
983 makeIndexForNodes(node.getChildren(), flatList);