KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > preferences > formatter > WhiteSpaceOptions


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.jdt.internal.ui.preferences.formatter;
13
14 import java.util.ArrayList JavaDoc;
15 import java.util.Collections JavaDoc;
16 import java.util.Iterator JavaDoc;
17 import java.util.List JavaDoc;
18 import java.util.Map JavaDoc;
19
20 import org.eclipse.jdt.core.JavaCore;
21 import org.eclipse.jdt.core.formatter.CodeFormatter;
22 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
23
24 import org.eclipse.jdt.internal.ui.preferences.formatter.SnippetPreview.PreviewSnippet;
25
26
27 /**
28  * Manage code formatter white space options on a higher level.
29  */

30 public final class WhiteSpaceOptions {
31
32     /**
33      * Represents a node in the options tree.
34      */

35     public abstract static class Node {
36         
37         private final InnerNode fParent;
38         private final String JavaDoc fName;
39         
40         public int index;
41         
42         protected final Map JavaDoc fWorkingValues;
43         protected final ArrayList JavaDoc fChildren;
44
45         public Node(InnerNode parent, Map JavaDoc workingValues, String JavaDoc message) {
46             if (workingValues == null || message == null)
47                 throw new IllegalArgumentException JavaDoc();
48             fParent= parent;
49             fWorkingValues= workingValues;
50             fName= message;
51             fChildren= new ArrayList JavaDoc();
52             if (fParent != null)
53                 fParent.add(this);
54         }
55         
56         public abstract void setChecked(boolean checked);
57
58         public boolean hasChildren() {
59             return !fChildren.isEmpty();
60         }
61         
62         public List JavaDoc getChildren() {
63             return Collections.unmodifiableList(fChildren);
64         }
65         
66         public InnerNode getParent() {
67             return fParent;
68         }
69
70         public final String JavaDoc toString() {
71             return fName;
72         }
73         
74         public abstract List JavaDoc getSnippets();
75         
76         public abstract void getCheckedLeafs(List JavaDoc list);
77     }
78     
79     /**
80      * A node representing a group of options in the tree.
81      */

82     public static class InnerNode extends Node {
83         
84         public InnerNode(InnerNode parent, Map JavaDoc workingValues, String JavaDoc messageKey) {
85             super(parent, workingValues, messageKey);
86         }
87
88         public void setChecked(boolean checked) {
89             for (final Iterator JavaDoc iter = fChildren.iterator(); iter.hasNext();)
90                 ((Node)iter.next()).setChecked(checked);
91         }
92
93         public void add(Node child) {
94             fChildren.add(child);
95         }
96
97         public List JavaDoc getSnippets() {
98             final ArrayList JavaDoc snippets= new ArrayList JavaDoc(fChildren.size());
99             for (Iterator JavaDoc iter= fChildren.iterator(); iter.hasNext();) {
100                 final List JavaDoc childSnippets= ((Node)iter.next()).getSnippets();
101                 for (final Iterator JavaDoc chIter= childSnippets.iterator(); chIter.hasNext(); ) {
102                     final Object JavaDoc snippet= chIter.next();
103                     if (!snippets.contains(snippet))
104                         snippets.add(snippet);
105                 }
106             }
107             return snippets;
108         }
109         
110         public void getCheckedLeafs(List JavaDoc list) {
111             for (Iterator JavaDoc iter= fChildren.iterator(); iter.hasNext();) {
112                 ((Node)iter.next()).getCheckedLeafs(list);
113             }
114         }
115     }
116
117     
118     /**
119      * A node representing a concrete white space option in the tree.
120      */

121     public static class OptionNode extends Node {
122         private final String JavaDoc fKey;
123         private final ArrayList JavaDoc fSnippets;
124         
125         public OptionNode(InnerNode parent, Map JavaDoc workingValues, String JavaDoc messageKey, String JavaDoc key, PreviewSnippet snippet) {
126             super(parent, workingValues, messageKey);
127             fKey= key;
128             fSnippets= new ArrayList JavaDoc(1);
129             fSnippets.add(snippet);
130         }
131         
132         public void setChecked(boolean checked) {
133             fWorkingValues.put(fKey, checked ? JavaCore.INSERT : JavaCore.DO_NOT_INSERT);
134         }
135         
136         public boolean getChecked() {
137             return JavaCore.INSERT.equals(fWorkingValues.get(fKey));
138         }
139         
140         public List JavaDoc getSnippets() {
141             return fSnippets;
142         }
143         
144         public void getCheckedLeafs(List JavaDoc list) {
145             if (getChecked())
146                 list.add(this);
147         }
148     }
149     
150     
151     
152     /**
153      * Preview snippets.
154      */

155     
156     private final PreviewSnippet FOR_PREVIEW= new PreviewSnippet(
157     CodeFormatter.K_STATEMENTS,
158     "for (int i= 0, j= array.length; i < array.length; i++, j--) {}\nfor (String s : names) {}" //$NON-NLS-1$
159
);
160
161     private final PreviewSnippet WHILE_PREVIEW= new PreviewSnippet(
162     CodeFormatter.K_STATEMENTS,
163     "while (condition) {}; do {} while (condition);" //$NON-NLS-1$
164
);
165
166     private final PreviewSnippet CATCH_PREVIEW= new PreviewSnippet(
167     CodeFormatter.K_STATEMENTS,
168     "try { number= Integer.parseInt(value); } catch (NumberFormatException e) {}"); //$NON-NLS-1$
169

170     private final PreviewSnippet IF_PREVIEW= new PreviewSnippet(
171     CodeFormatter.K_STATEMENTS,
172     "if (condition) { return foo; } else {return bar;}"); //$NON-NLS-1$
173

174     private final PreviewSnippet SYNCHRONIZED_PREVIEW= new PreviewSnippet(
175     CodeFormatter.K_STATEMENTS,
176     "synchronized (list) { list.add(element); }"); //$NON-NLS-1$
177

178     private final PreviewSnippet SWITCH_PREVIEW= new PreviewSnippet(
179     CodeFormatter.K_STATEMENTS,
180     "switch (number) { case RED: return GREEN; case GREEN: return BLUE; case BLUE: return RED; default: return BLACK;}"); //$NON-NLS-1$
181

182     private final PreviewSnippet CONSTRUCTOR_DECL_PREVIEW= new PreviewSnippet(
183     CodeFormatter.K_CLASS_BODY_DECLARATIONS,
184     "MyClass() throws E0, E1 { this(0,0,0);}" + //$NON-NLS-1$
185
"MyClass(int x, int y, int z) throws E0, E1 { super(x, y, z, true);}"); //$NON-NLS-1$
186

187     private final PreviewSnippet METHOD_DECL_PREVIEW= new PreviewSnippet(
188     CodeFormatter.K_CLASS_BODY_DECLARATIONS,
189     "void foo() throws E0, E1 {};" + //$NON-NLS-1$
190
"void bar(int x, int y) throws E0, E1 {}"); //$NON-NLS-1$
191

192     private final PreviewSnippet ARRAY_DECL_PREVIEW= new PreviewSnippet(
193     CodeFormatter.K_STATEMENTS,
194     "int [] array0= new int [] {};\n" + //$NON-NLS-1$
195
"int [] array1= new int [] {1, 2, 3};\n" + //$NON-NLS-1$
196
"int [] array2= new int[3];"); //$NON-NLS-1$
197

198     private final PreviewSnippet ARRAY_REF_PREVIEW= new PreviewSnippet(
199     CodeFormatter.K_STATEMENTS,
200     "array[i].foo();"); //$NON-NLS-1$
201

202     private final PreviewSnippet METHOD_CALL_PREVIEW= new PreviewSnippet(
203     CodeFormatter.K_STATEMENTS,
204     "foo();\n" + //$NON-NLS-1$
205
"bar(x, y);"); //$NON-NLS-1$
206

207 // private final PreviewSnippet CONSTR_CALL_PREVIEW= new PreviewSnippet(
208
// CodeFormatter.K_STATEMENTS,
209
// "this();\n\n" + //$NON-NLS-1$
210
// "this(x, y);\n"); //$NON-NLS-1$
211

212     private final PreviewSnippet ALLOC_PREVIEW= new PreviewSnippet(
213     CodeFormatter.K_STATEMENTS,
214     "String str= new String(); Point point= new Point(x, y);"); //$NON-NLS-1$
215

216     private final PreviewSnippet LABEL_PREVIEW= new PreviewSnippet(
217     CodeFormatter.K_STATEMENTS,
218     "label: for (int i= 0; i<list.length; i++) {for (int j= 0; j < list[i].length; j++) continue label;}"); //$NON-NLS-1$
219

220     private final PreviewSnippet SEMICOLON_PREVIEW= new PreviewSnippet(
221     CodeFormatter.K_STATEMENTS,
222     "int a= 4; foo(); bar(x, y);"); //$NON-NLS-1$
223

224     private final PreviewSnippet CONDITIONAL_PREVIEW= new PreviewSnippet(
225     CodeFormatter.K_STATEMENTS,
226     "String value= condition ? TRUE : FALSE;"); //$NON-NLS-1$
227

228     private final PreviewSnippet CLASS_DECL_PREVIEW= new PreviewSnippet(
229     CodeFormatter.K_COMPILATION_UNIT,
230     "class MyClass implements I0, I1, I2 {}"); //$NON-NLS-1$
231

232     private final PreviewSnippet ANON_CLASS_PREVIEW= new PreviewSnippet(
233     CodeFormatter.K_STATEMENTS,
234     "AnonClass= new AnonClass() {void foo(Some s) { }};"); //$NON-NLS-1$
235

236     private final PreviewSnippet OPERATOR_PREVIEW= new PreviewSnippet(
237     CodeFormatter.K_STATEMENTS,
238     "List list= new ArrayList(); int a= -4 + -9; b= a++ / --number; c += 4; boolean value= true && false;"); //$NON-NLS-1$
239

240     private final PreviewSnippet CAST_PREVIEW= new PreviewSnippet(
241     CodeFormatter.K_STATEMENTS,
242     "String s= ((String)object);"); //$NON-NLS-1$
243

244     private final PreviewSnippet MULT_LOCAL_PREVIEW= new PreviewSnippet(
245     CodeFormatter.K_STATEMENTS,
246     "int a= 0, b= 1, c= 2, d= 3;"); //$NON-NLS-1$
247

248     private final PreviewSnippet MULT_FIELD_PREVIEW= new PreviewSnippet(
249     CodeFormatter.K_CLASS_BODY_DECLARATIONS,
250     "int a=0,b=1,c=2,d=3;"); //$NON-NLS-1$
251

252     private final PreviewSnippet BLOCK_PREVIEW= new PreviewSnippet(
253     CodeFormatter.K_STATEMENTS,
254     "if (true) { return 1; } else { return 2; }"); //$NON-NLS-1$
255

256     private final PreviewSnippet PAREN_EXPR_PREVIEW= new PreviewSnippet(
257     CodeFormatter.K_STATEMENTS,
258     "result= (a *( b + c + d) * (e + f));"); //$NON-NLS-1$
259

260     private final PreviewSnippet ASSERT_PREVIEW= new PreviewSnippet(
261         CodeFormatter.K_STATEMENTS,
262         "assert condition : reportError();" //$NON-NLS-1$
263
);
264     
265     private final PreviewSnippet RETURN_PREVIEW= new PreviewSnippet(
266         CodeFormatter.K_STATEMENTS,
267         "return (o);" //$NON-NLS-1$
268
);
269     
270     private final PreviewSnippet THROW_PREVIEW= new PreviewSnippet(
271         CodeFormatter.K_STATEMENTS,
272         "throw (e);" //$NON-NLS-1$
273
);
274
275     private final PreviewSnippet ANNOTATION_DECL_PREVIEW= new PreviewSnippet(
276         CodeFormatter.K_CLASS_BODY_DECLARATIONS,
277         "@interface MyAnnotation { String value(); }\n@interface OtherAnnotation { }\n" //$NON-NLS-1$
278
);
279     
280     private final PreviewSnippet ANNOTATION_MODIFIER_PREVIEW= new PreviewSnippet(
281         CodeFormatter.K_CLASS_BODY_DECLARATIONS,
282         "@Annot(x=23, y=-3)\npublic class A { }\n" //$NON-NLS-1$
283
);
284     
285     private final PreviewSnippet ENUM_PREVIEW= new PreviewSnippet(
286         CodeFormatter.K_CLASS_BODY_DECLARATIONS,
287         "enum MyEnum { GREEN(0, 1), RED() {\nvoid process() {}\n}\n}" //$NON-NLS-1$
288
);
289     
290     private final PreviewSnippet PARAMETERIZED_TYPE_REFERENCE_PREVIEW= new PreviewSnippet(
291             CodeFormatter.K_CLASS_BODY_DECLARATIONS,
292             "Map<String, Element> map=\n new HashMap<String, Element>();" //$NON-NLS-1$
293
);
294         
295     private final PreviewSnippet TYPE_ARGUMENTS_PREVIEW= new PreviewSnippet(
296             CodeFormatter.K_STATEMENTS,
297             "x.<String, Element>foo();" //$NON-NLS-1$
298
);
299     
300     private final PreviewSnippet TYPE_PARAMETER_PREVIEW= new PreviewSnippet(
301             CodeFormatter.K_CLASS_BODY_DECLARATIONS,
302             "class MyGenericType<S, T extends Element & List> { }" //$NON-NLS-1$
303
);
304     
305     private final PreviewSnippet VARARG_PARAMETER_PREVIEW= new PreviewSnippet(
306             CodeFormatter.K_CLASS_BODY_DECLARATIONS,
307             "void format(String s, Object ... args) {}" //$NON-NLS-1$
308
);
309     
310     private final PreviewSnippet WILDCARD_PREVIEW= new PreviewSnippet(
311             CodeFormatter.K_CLASS_BODY_DECLARATIONS,
312             "Map<X<?>, Y<? extends K, ? super V>> t;" //$NON-NLS-1$
313
);
314         
315     /**
316      * Create the tree, in this order: syntax element - position - abstract element
317      * @param workingValues
318      * @return returns roots (type <code>Node</code>)
319      */

320     public List JavaDoc createTreeBySyntaxElem(Map JavaDoc workingValues) {
321         final ArrayList JavaDoc roots= new ArrayList JavaDoc();
322         
323         InnerNode element;
324
325         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_paren);
326         createBeforeOpenParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
327         createAfterOpenParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
328         roots.add(element);
329         
330         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_paren);
331         createBeforeClosingParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
332         createAfterCloseParenTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
333         roots.add(element);
334         
335         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_brace);
336         createBeforeOpenBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
337         createAfterOpenBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
338         roots.add(element);
339         
340         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_brace);
341         createBeforeClosingBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
342         createAfterCloseBraceTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
343         roots.add(element);
344         
345         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_opening_bracket);
346         createBeforeOpenBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
347         createAfterOpenBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
348         roots.add(element);
349         
350         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_closing_bracket);
351         createBeforeClosingBracketTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
352         roots.add(element);
353         
354         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_operator);
355         createBeforeOperatorTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
356         createAfterOperatorTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
357         roots.add(element);
358         
359         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_comma);
360         createBeforeCommaTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
361         createAfterCommaTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
362         roots.add(element);
363         
364         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_colon);
365         createBeforeColonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
366         createAfterColonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
367         roots.add(element);
368         
369         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_semicolon);
370         createBeforeSemicolonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
371         createAfterSemicolonTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
372         roots.add(element);
373         
374         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_question_mark);
375         createBeforeQuestionTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_before));
376         createAfterQuestionTree(workingValues, createChild(element, workingValues, FormatterMessages.WhiteSpaceOptions_after));
377         roots.add(element);
378
379         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_parens);
380         createBetweenEmptyParenTree(workingValues, element);
381         roots.add(element);
382
383         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_braces);
384         createBetweenEmptyBracesTree(workingValues, element);
385         roots.add(element);
386         
387         element= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_brackets);
388         createBetweenEmptyBracketsTree(workingValues, element);
389         roots.add(element);
390
391         return roots;
392     }
393     
394     /**
395      * Create the tree, in this order: position - syntax element - abstract
396      * element
397      * @param workingValues
398      * @return returns roots (type <code>Node</code>)
399      */

400     public List JavaDoc createAltTree(Map JavaDoc workingValues) {
401
402         final ArrayList JavaDoc roots= new ArrayList JavaDoc();
403         
404         InnerNode parent;
405         
406         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_paren);
407         createBeforeOpenParenTree(workingValues, parent);
408
409         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_paren);
410         createAfterOpenParenTree(workingValues, parent);
411         
412         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_paren);
413         createBeforeClosingParenTree(workingValues, parent);
414         
415         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_paren);
416         createAfterCloseParenTree(workingValues, parent);
417         
418         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_parens);
419         createBetweenEmptyParenTree(workingValues, parent);
420         
421         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_brace);
422         createBeforeOpenBraceTree(workingValues, parent);
423         
424         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_brace);
425         createAfterOpenBraceTree(workingValues, parent);
426
427         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_brace);
428         createBeforeClosingBraceTree(workingValues, parent);
429         
430         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_brace);
431         createAfterCloseBraceTree(workingValues, parent);
432
433         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_braces);
434         createBetweenEmptyBracesTree(workingValues, parent);
435
436         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_bracket);
437         createBeforeOpenBracketTree(workingValues, parent);
438
439         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_bracket);
440         createAfterOpenBracketTree(workingValues, parent);
441         
442         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_bracket);
443         createBeforeClosingBracketTree(workingValues, parent);
444         
445         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_between_empty_brackets);
446         createBetweenEmptyBracketsTree(workingValues, parent);
447
448         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_opening_angle_bracket);
449         createBeforeOpenAngleBracketTree(workingValues, parent);
450
451         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_opening_angle_bracket);
452         createAfterOpenAngleBracketTree(workingValues, parent);
453         
454         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_closing_angle_bracket);
455         createBeforeClosingAngleBracketTree(workingValues, parent);
456         
457         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_closing_angle_bracket);
458         createAfterClosingAngleBracketTree(workingValues, parent);
459  
460         
461         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_operator);
462         createBeforeOperatorTree(workingValues, parent);
463         
464         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_operator);
465         createAfterOperatorTree(workingValues, parent);
466         
467         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_comma);
468         createBeforeCommaTree(workingValues, parent);
469         
470         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_comma);
471         createAfterCommaTree(workingValues, parent);
472         
473         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_colon);
474         createAfterColonTree(workingValues, parent);
475         
476         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_colon);
477         createBeforeColonTree(workingValues, parent);
478         
479         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_semicolon);
480         createBeforeSemicolonTree(workingValues, parent);
481         
482         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_semicolon);
483         createAfterSemicolonTree(workingValues, parent);
484         
485         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_question_mark);
486         createBeforeQuestionTree(workingValues, parent);
487         
488         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_question_mark);
489         createAfterQuestionTree(workingValues, parent);
490         
491         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_at);
492         createBeforeAtTree(workingValues, parent);
493         
494         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_at);
495         createAfterAtTree(workingValues, parent);
496
497         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_and);
498         createBeforeAndTree(workingValues, parent);
499         
500         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_and);
501         createAfterAndTree(workingValues, parent);
502         
503         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_before_ellipsis);
504         createBeforeEllipsis(workingValues, parent);
505         
506         parent= createParentNode(roots, workingValues, FormatterMessages.WhiteSpaceOptions_after_ellipsis);
507         createAfterEllipsis(workingValues, parent);
508         
509         return roots;
510     }
511
512     private InnerNode createParentNode(List JavaDoc roots, Map JavaDoc workingValues, String JavaDoc text) {
513         final InnerNode parent= new InnerNode(null, workingValues, text);
514         roots.add(parent);
515         return parent;
516     }
517
518     public ArrayList JavaDoc createTreeByJavaElement(Map JavaDoc workingValues) {
519
520         final InnerNode declarations= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_declarations);
521         createClassTree(workingValues, declarations);
522         createFieldTree(workingValues, declarations);
523         createLocalVariableTree(workingValues, declarations);
524         createConstructorTree(workingValues, declarations);
525         createMethodDeclTree(workingValues, declarations);
526         createLabelTree(workingValues, declarations);
527         createAnnotationTree(workingValues, declarations);
528         createEnumTree(workingValues, declarations);
529         createAnnotationTypeTree(workingValues, declarations);
530         
531         final InnerNode statements= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_statements);
532         createOption(statements, workingValues, FormatterMessages.WhiteSpaceOptions_before_semicolon, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, SEMICOLON_PREVIEW);
533         createBlockTree(workingValues, statements);
534         createIfStatementTree(workingValues, statements);
535         createForStatementTree(workingValues, statements);
536         createSwitchStatementTree(workingValues, statements);
537         createDoWhileTree(workingValues, statements);
538         createSynchronizedTree(workingValues, statements);
539         createTryStatementTree(workingValues, statements);
540         createAssertTree(workingValues, statements);
541         createReturnTree(workingValues, statements);
542         createThrowTree(workingValues, statements);
543         
544         final InnerNode expressions= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_expressions);
545         createFunctionCallTree(workingValues, expressions);
546         createAssignmentTree(workingValues, expressions);
547         createOperatorTree(workingValues, expressions);
548         createParenthesizedExpressionTree(workingValues, expressions);
549         createTypecastTree(workingValues, expressions);
550         createConditionalTree(workingValues, expressions);
551         
552         final InnerNode arrays= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_arrays);
553         createArrayDeclarationTree(workingValues, arrays);
554         createArrayAllocTree(workingValues, arrays);
555         createArrayInitializerTree(workingValues, arrays);
556         createArrayElementAccessTree(workingValues, arrays);
557         
558         final InnerNode paramtypes= new InnerNode(null, workingValues, FormatterMessages.WhiteSpaceTabPage_parameterized_types);
559         createParameterizedTypeTree(workingValues, paramtypes);
560         createTypeArgumentTree(workingValues, paramtypes);
561         createTypeParameterTree(workingValues, paramtypes);
562         createWildcardTypeTree(workingValues, paramtypes);
563         
564         final ArrayList JavaDoc roots= new ArrayList JavaDoc();
565         roots.add(declarations);
566         roots.add(statements);
567         roots.add(expressions);
568         roots.add(arrays);
569         roots.add(paramtypes);
570         return roots;
571     }
572     
573     private void createBeforeQuestionTree(Map JavaDoc workingValues, final InnerNode parent) {
574         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
575         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_wildcard, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_QUESTION_IN_WILDCARD, WILDCARD_PREVIEW);
576     }
577     
578     private void createBeforeAtTree(Map JavaDoc workingValues, final InnerNode parent) {
579         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_type, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_AT_IN_ANNOTATION_TYPE_DECLARATION, ANNOTATION_DECL_PREVIEW);
580     }
581     
582     private void createBeforeAndTree(Map JavaDoc workingValues, final InnerNode parent) {
583         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_IN_TYPE_PARAMETER, TYPE_PARAMETER_PREVIEW);
584     }
585
586     private void createBeforeSemicolonTree(Map JavaDoc workingValues, final InnerNode parent) {
587         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON_IN_FOR, FOR_PREVIEW);
588         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_statements, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_SEMICOLON, SEMICOLON_PREVIEW);
589     }
590
591     private void createBeforeColonTree(Map JavaDoc workingValues, final InnerNode parent) {
592         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_assert, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_ASSERT, ASSERT_PREVIEW);
593         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_conditional, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CONDITIONAL, CONDITIONAL_PREVIEW);
594         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_label, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_LABELED_STATEMENT, LABEL_PREVIEW);
595
596         final InnerNode switchStatement= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch);
597         createOption(switchStatement, workingValues, FormatterMessages.WhiteSpaceOptions_case, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_CASE, SWITCH_PREVIEW);
598         createOption(switchStatement, workingValues, FormatterMessages.WhiteSpaceOptions_default, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_DEFAULT, SWITCH_PREVIEW);
599     
600         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COLON_IN_FOR, FOR_PREVIEW);
601     }
602
603     private void createBeforeCommaTree(Map JavaDoc workingValues, final InnerNode parent) {
604
605         final InnerNode forStatement= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for);
606         createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_initialization, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INITS, FOR_PREVIEW);
607         createOption(forStatement, workingValues, FormatterMessages.WhiteSpaceOptions_incrementation, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_FOR_INCREMENTS, FOR_PREVIEW);
608             
609         final InnerNode invocation= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_arguments);
610         createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_INVOCATION_ARGUMENTS, METHOD_CALL_PREVIEW);
611         createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_explicit_constructor_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_EXPLICIT_CONSTRUCTOR_CALL_ARGUMENTS, CONSTRUCTOR_DECL_PREVIEW);
612         createOption(invocation, workingValues, FormatterMessages.WhiteSpaceOptions_alloc_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ALLOCATION_EXPRESSION, ALLOC_PREVIEW);
613
614         final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameters);
615         createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_PARAMETERS, CONSTRUCTOR_DECL_PREVIEW);
616         createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_PARAMETERS, METHOD_DECL_PREVIEW);
617
618         final InnerNode throwsDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throws);
619         createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_CONSTRUCTOR_DECLARATION_THROWS, CONSTRUCTOR_DECL_PREVIEW);
620         createOption(throwsDecl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_METHOD_DECLARATION_THROWS, METHOD_DECL_PREVIEW);
621         
622         final InnerNode multDecls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_mult_decls);
623         createOption(multDecls, workingValues, FormatterMessages.WhiteSpaceOptions_fields, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_FIELD_DECLARATIONS, MULT_FIELD_PREVIEW);
624         createOption(multDecls, workingValues, FormatterMessages.WhiteSpaceOptions_local_vars, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_MULTIPLE_LOCAL_DECLARATIONS, MULT_LOCAL_PREVIEW);
625
626         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ARRAY_INITIALIZER, ARRAY_DECL_PREVIEW);
627         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_implements_clause, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_SUPERINTERFACES, CLASS_DECL_PREVIEW);
628         
629         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_DECLARATIONS, ENUM_PREVIEW);
630         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_constant_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ENUM_CONSTANT_ARGUMENTS, ENUM_PREVIEW);
631
632         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_modifier, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_ANNOTATION, ANNOTATION_MODIFIER_PREVIEW);
633         
634         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_PARAMETERS, TYPE_PARAMETER_PREVIEW);
635         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameterized_type, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_PARAMETERIZED_TYPE_REFERENCE, TYPE_ARGUMENTS_PREVIEW);
636         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_COMMA_IN_TYPE_ARGUMENTS, TYPE_ARGUMENTS_PREVIEW);
637      }
638
639     private void createBeforeOperatorTree(Map JavaDoc workingValues, final InnerNode parent) {
640         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_assignment_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_ASSIGNMENT_OPERATOR, OPERATOR_PREVIEW);
641         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_unary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_UNARY_OPERATOR, OPERATOR_PREVIEW);
642         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_binary_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_BINARY_OPERATOR, OPERATOR_PREVIEW);
643         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_prefix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PREFIX_OPERATOR, OPERATOR_PREVIEW);
644         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_postfix_operator, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_POSTFIX_OPERATOR, OPERATOR_PREVIEW);
645     }
646
647     private void createBeforeClosingBracketTree(Map JavaDoc workingValues, final InnerNode parent) {
648         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, ARRAY_DECL_PREVIEW);
649         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_element_access, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACKET_IN_ARRAY_REFERENCE, ARRAY_REF_PREVIEW);
650     }
651
652     private void createBeforeClosingAngleBracketTree(Map JavaDoc workingValues, final InnerNode parent) {
653         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, TYPE_PARAMETER_PREVIEW);
654         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameterized_type, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, TYPE_ARGUMENTS_PREVIEW);
655         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, TYPE_ARGUMENTS_PREVIEW);
656     }
657     
658     
659     private void createBeforeOpenBracketTree(Map JavaDoc workingValues, final InnerNode parent) {
660         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_TYPE_REFERENCE, ARRAY_DECL_PREVIEW);
661         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_alloc, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_ALLOCATION_EXPRESSION, ARRAY_DECL_PREVIEW);
662         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_element_access, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACKET_IN_ARRAY_REFERENCE, ARRAY_REF_PREVIEW);
663     }
664     
665     private void createBeforeOpenAngleBracketTree(Map JavaDoc workingValues, final InnerNode parent) {
666         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_parameters, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_PARAMETERS, TYPE_PARAMETER_PREVIEW);
667         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_parameterized_type, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_PARAMETERIZED_TYPE_REFERENCE, TYPE_ARGUMENTS_PREVIEW);
668         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_ANGLE_BRACKET_IN_TYPE_ARGUMENTS, TYPE_ARGUMENTS_PREVIEW);
669     }
670
671     private void createBeforeClosingBraceTree(Map JavaDoc workingValues, final InnerNode parent) {
672         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_array_init, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, CLASS_DECL_PREVIEW);
673     }
674     
675     private void createBeforeOpenBraceTree(Map JavaDoc workingValues, final InnerNode parent) {
676
677         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_class_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_TYPE_DECLARATION, CLASS_DECL_PREVIEW);
678         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_anon_class_decl, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANONYMOUS_TYPE_DECLARATION, ANON_CLASS_PREVIEW);
679
680         final InnerNode functionDecl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration); {
681             createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW);
682             createOption(functionDecl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
683         }
684         
685         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_initializer, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, ARRAY_DECL_PREVIEW);
686         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_block, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_BLOCK, BLOCK_PREVIEW);
687         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_SWITCH, SWITCH_PREVIEW);
688     
689         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_declaration, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_DECLARATION, ENUM_PREVIEW);
690         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_constant_body, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ENUM_CONSTANT, ENUM_PREVIEW);
691         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_type, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ANNOTATION_TYPE_DECLARATION, ANNOTATION_DECL_PREVIEW);
692     }
693
694     private void createBeforeClosingParenTree(Map JavaDoc workingValues, final InnerNode parent) {
695
696         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CATCH, CATCH_PREVIEW);
697         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_FOR, FOR_PREVIEW);
698         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_if, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_IF, IF_PREVIEW);
699         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
700         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_synchronized, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_SYNCHRONIZED, SYNCHRONIZED_PREVIEW);
701         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_WHILE, WHILE_PREVIEW);
702     
703         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_type_cast, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CAST, CAST_PREVIEW);
704             
705         final InnerNode decl= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration);
706         createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW);
707         createOption(decl, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
708
709         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
710         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
711     
712         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_constant_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ENUM_CONSTANT, ENUM_PREVIEW);
713         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_modifier_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_PAREN_IN_ANNOTATION, ANNOTATION_MODIFIER_PREVIEW);
714  
715     }
716
717     private void createBeforeOpenParenTree(Map JavaDoc workingValues, final InnerNode parent) {
718
719         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_catch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CATCH, CATCH_PREVIEW);
720         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_for, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_FOR, FOR_PREVIEW);
721         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_if, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_IF, IF_PREVIEW);
722         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_switch, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SWITCH, SWITCH_PREVIEW);
723         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_synchronized, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_SYNCHRONIZED, SYNCHRONIZED_PREVIEW);
724         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_while, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_WHILE, WHILE_PREVIEW);
725         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_return_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_RETURN, RETURN_PREVIEW);
726         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_throw_with_parenthesized_expression, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_PARENTHESIZED_EXPRESSION_IN_THROW, THROW_PREVIEW);
727
728         final InnerNode decls= createChild(parent, workingValues, FormatterMessages.WhiteSpaceOptions_member_function_declaration);
729         createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_constructor, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_CONSTRUCTOR_DECLARATION, CONSTRUCTOR_DECL_PREVIEW);
730         createOption(decls, workingValues, FormatterMessages.WhiteSpaceOptions_method, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_DECLARATION, METHOD_DECL_PREVIEW);
731         
732         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_method_call, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_METHOD_INVOCATION, METHOD_CALL_PREVIEW);
733         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_paren_expr, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_PARENTHESIZED_EXPRESSION, PAREN_EXPR_PREVIEW);
734     
735         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_enum_constant_arguments, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ENUM_CONSTANT, ENUM_PREVIEW);
736         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_modifier_args, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION, ANNOTATION_MODIFIER_PREVIEW);
737         createOption(parent, workingValues, FormatterMessages.WhiteSpaceOptions_annotation_type_member, DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_PAREN_IN_ANNOTATION_TYPE_MEMBER_DECLARATION, ANNOTATION_DECL_PREVIEW);
738                
739     }
740
741