]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/core extension/org/eclipse/jdt/internal/corext/fix/CleanUpConstants.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / core extension / org / eclipse / jdt / internal / corext / fix / CleanUpConstants.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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  *     Alex Blewitt - https://bugs.eclipse.org/bugs/show_bug.cgi?id=168954
11  *******************************************************************************/
12 package org.eclipse.jdt.internal.corext.fix;
13
14 import java.util.Iterator;
15
16 import org.eclipse.core.runtime.Assert;
17
18 import org.eclipse.jface.preference.IPreferenceStore;
19
20 import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
21
22 import org.eclipse.jdt.ui.cleanup.CleanUpOptions;
23
24 import org.eclipse.jdt.internal.ui.JavaPlugin;
25 import org.eclipse.jdt.internal.ui.fix.UnimplementedCodeCleanUp;
26 import org.eclipse.jdt.internal.ui.preferences.cleanup.CleanUpProfileVersioner;
27
28 public class CleanUpConstants {
29
30         /**
31          * Constant for default options kind for clean up.
32          */
33         public static final int DEFAULT_CLEAN_UP_OPTIONS= 1;
34
35         /**
36          * Constant for default options kind for save actions.
37          */
38         public static final int DEFAULT_SAVE_ACTION_OPTIONS= 2;
39
40         /**
41          * Format Java Source Code <br>
42          * <br>
43          * Possible values: {TRUE, FALSE}<br>
44          * <br>
45          * 
46          * @see CleanUpOptions#TRUE
47          * @see CleanUpOptions#FALSE
48          * @since 3.3
49          */
50         public static final String FORMAT_SOURCE_CODE= "cleanup.format_source_code"; //$NON-NLS-1$
51
52         /**
53          * If true then only changed regions are formatted on save. Only has an effect if
54          * {@link #FORMAT_SOURCE_CODE} is TRUE <br>
55          * <br>
56          * <br>
57          * Possible values: {TRUE, FALSE}<br>
58          * 
59          * <br>
60          * 
61          * @see CleanUpOptions#TRUE
62          * @see CleanUpOptions#FALSE
63          * @since 3.4
64          */
65         public static final String FORMAT_SOURCE_CODE_CHANGES_ONLY= "cleanup.format_source_code_changes_only"; //$NON-NLS-1$
66
67         /**
68          * Format comments. Specify which comment with:<br> {@link #FORMAT_JAVADOC}<br>
69          * {@link #FORMAT_MULTI_LINE_COMMENT}<br> {@link #FORMAT_SINGLE_LINE_COMMENT} <br>
70          * <br>
71          * Possible values: {TRUE, FALSE}<br>
72          * 
73          * <br>
74          * 
75          * @see CleanUpOptions#TRUE
76          * @see CleanUpOptions#FALSE
77          * @since 3.3
78          * @deprecated replaced by {@link #FORMAT_SOURCE_CODE}
79          */
80         public static final String FORMAT_COMMENT= "cleanup.format_comment"; //$NON-NLS-1$
81
82         /**
83          * Format single line comments. Only has an effect if {@link #FORMAT_COMMENT} is TRUE <br>
84          * <br>
85          * Possible values: {TRUE, FALSE}<br>
86          * 
87          * <br>
88          * 
89          * @see CleanUpOptions#TRUE
90          * @see CleanUpOptions#FALSE
91          * @since 3.3
92          * @deprecated replaced by
93          *             {@link DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_LINE_COMMENT}
94          */
95         public static final String FORMAT_SINGLE_LINE_COMMENT= "cleanup.format_single_line_comment"; //$NON-NLS-1$
96
97         /**
98          * Format multi line comments. Only has an effect if {@link #FORMAT_COMMENT} is TRUE <br>
99          * <br>
100          * Possible values: {TRUE, FALSE}<br>
101          * 
102          * <br>
103          * 
104          * @see CleanUpOptions#TRUE
105          * @see CleanUpOptions#FALSE
106          * @since 3.3
107          * @deprecated replaced by
108          *             {@link DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_BLOCK_COMMENT}
109          */
110         public static final String FORMAT_MULTI_LINE_COMMENT= "cleanup.format_multi_line_comment"; //$NON-NLS-1$
111
112         /**
113          * Format javadoc comments. Only has an effect if {@link #FORMAT_COMMENT} is TRUE <br>
114          * <br>
115          * Possible values: {TRUE, FALSE}<br>
116          * 
117          * <br>
118          * 
119          * @see CleanUpOptions#TRUE
120          * @see CleanUpOptions#FALSE
121          * @since 3.3
122          * @deprecated replaced by
123          *             {@link DefaultCodeFormatterConstants#FORMATTER_COMMENT_FORMAT_JAVADOC_COMMENT}
124          */
125         public static final String FORMAT_JAVADOC= "cleanup.format_javadoc"; //$NON-NLS-1$
126
127         /**
128          * Removes trailing whitespace in compilation units<br>
129          * <br>
130          * Possible values: {TRUE, FALSE}<br>
131          * 
132          * <br>
133          * 
134          * @see CleanUpOptions#TRUE
135          * @see CleanUpOptions#FALSE
136          * @since 3.3
137          */
138         public static final String FORMAT_REMOVE_TRAILING_WHITESPACES= "cleanup.remove_trailing_whitespaces"; //$NON-NLS-1$
139
140         /**
141          * Removes trailing whitespace in compilation units on all lines<br>
142          * Only has an effect if {@link #FORMAT_REMOVE_TRAILING_WHITESPACES} is TRUE <br>
143          * <br>
144          * Possible values: {TRUE, FALSE}<br>
145          * 
146          * <br>
147          * 
148          * @see CleanUpOptions#TRUE
149          * @see CleanUpOptions#FALSE
150          * @since 3.3
151          */
152         public static final String FORMAT_REMOVE_TRAILING_WHITESPACES_ALL= "cleanup.remove_trailing_whitespaces_all"; //$NON-NLS-1$
153
154         /**
155          * Removes trailing whitespace in compilation units on all lines which contain an other
156          * characters then whitespace<br>
157          * Only has an effect if {@link #FORMAT_REMOVE_TRAILING_WHITESPACES} is TRUE <br>
158          * <br>
159          * Possible values: {TRUE, FALSE}<br>
160          * 
161          * <br>
162          * 
163          * @see CleanUpOptions#TRUE
164          * @see CleanUpOptions#FALSE
165          * @since 3.3
166          */
167         public static final String FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY= "cleanup.remove_trailing_whitespaces_ignore_empty"; //$NON-NLS-1$
168
169         /**
170          * Correct indentation in compilation units on all lines <br>
171          * <br>
172          * Possible values: {TRUE, FALSE}<br>
173          * 
174          * <br>
175          * 
176          * @see CleanUpOptions#TRUE
177          * @see CleanUpOptions#FALSE
178          * @since 3.4
179          */
180         public static final String FORMAT_CORRECT_INDENTATION= "cleanup.correct_indentation"; //$NON-NLS-1$
181
182         /**
183          * Controls access qualifiers for instance fields. For detailed settings use<br>
184          * {@link #MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS}<br>
185          * {@link #MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY} <br>
186          * <br>
187          * Possible values: {TRUE, FALSE}<br>
188          * 
189          * <br>
190          * 
191          * @see CleanUpOptions#TRUE
192          * @see CleanUpOptions#FALSE
193          * @since 3.3
194          */
195         public static final String MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS= "cleanup.use_this_for_non_static_field_access"; //$NON-NLS-1$
196
197         /**
198          * Adds a 'this' qualifier to field accesses.
199          * <p>
200          * Example:
201          * 
202          * <pre>
203          *                     int fField;
204          *                     void foo() {fField= 10;} -&gt; void foo() {this.fField= 10;}
205          * </pre>
206          * 
207          * Only has an effect if {@link #MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS} is TRUE <br>
208          * <br>
209          * Possible values: {TRUE, FALSE}<br>
210          * 
211          * <br>
212          * 
213          * @see CleanUpOptions#TRUE
214          * @see CleanUpOptions#FALSE
215          * @since 3.3
216          */
217         public static final String MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS= "cleanup.always_use_this_for_non_static_field_access"; //$NON-NLS-1$
218
219         /**
220          * Removes 'this' qualifier to field accesses.
221          * <p>
222          * Example:
223          * 
224          * <pre>
225          *                     int fField;
226          *                     void foo() {this.fField= 10;} -&gt; void foo() {fField= 10;}
227          * </pre>
228          * 
229          * Only has an effect if {@link #MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS} is TRUE <br>
230          * <br>
231          * Possible values: {TRUE, FALSE}<br>
232          * 
233          * <br>
234          * 
235          * @see CleanUpOptions#TRUE
236          * @see CleanUpOptions#FALSE
237          * @since 3.3
238          */
239         public static final String MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY= "cleanup.use_this_for_non_static_field_access_only_if_necessary"; //$NON-NLS-1$
240
241         /**
242          * Controls access qualifiers for instance methods. For detailed settings use<br>
243          * {@link #MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS}<br>
244          * {@link #MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY} <br>
245          * <br>
246          * Possible values: {TRUE, FALSE}<br>
247          * 
248          * <br>
249          * 
250          * @see CleanUpOptions#TRUE
251          * @see CleanUpOptions#FALSE
252          * @since 3.3
253          */
254         public static final String MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS= "cleanup.use_this_for_non_static_method_access"; //$NON-NLS-1$
255
256         /**
257          * Adds a 'this' qualifier to method accesses.
258          * <p>
259          * Example:
260          * 
261          * <pre>
262          *                     int method(){};
263          *                     void foo() {method()} -&gt; void foo() {this.method();}
264          * </pre>
265          * 
266          * Only has an effect if {@link #MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS} is TRUE <br>
267          * <br>
268          * Possible values: {TRUE, FALSE}<br>
269          * 
270          * <br>
271          * 
272          * @see CleanUpOptions#TRUE
273          * @see CleanUpOptions#FALSE
274          * @since 3.3
275          */
276         public static final String MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS= "cleanup.always_use_this_for_non_static_method_access"; //$NON-NLS-1$
277
278         /**
279          * Removes 'this' qualifier from field accesses.
280          * <p>
281          * Example:
282          * 
283          * <pre>
284          *                     int fField;
285          *                     void foo() {this.fField= 10;} -&gt; void foo() {fField= 10;}
286          * </pre>
287          * 
288          * Only has an effect if {@link #MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS} is TRUE <br>
289          * <br>
290          * Possible values: {TRUE, FALSE}<br>
291          * 
292          * <br>
293          * 
294          * @see CleanUpOptions#TRUE
295          * @see CleanUpOptions#FALSE
296          * @since 3.3
297          */
298         public static final String MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY= "cleanup.use_this_for_non_static_method_access_only_if_necessary"; //$NON-NLS-1$
299
300         /**
301          * Controls access qualifiers for static members. For detailed settings use<br>
302          * {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD}<br>
303          * {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS}<br>
304          * {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD}<br>
305          * {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS} <br>
306          * <br>
307          * Possible values: {TRUE, FALSE}<br>
308          * 
309          * <br>
310          * 
311          * @see CleanUpOptions#TRUE
312          * @see CleanUpOptions#FALSE
313          * @since 3.3
314          */
315         public static final String MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS= "cleanup.qualify_static_member_accesses_with_declaring_class"; //$NON-NLS-1$
316
317         /**
318          * Qualify static field accesses with declaring type.
319          * <p>
320          * Example:
321          * 
322          * <pre>
323          *                   class E {
324          *                     public static int i;
325          *                     void foo() {i= 10;} -&gt; void foo() {E.i= 10;}
326          *                   }
327          * </pre>
328          * 
329          * <br>
330          * Only has an effect if {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS} is TRUE <br>
331          * <br>
332          * Possible values: {TRUE, FALSE}<br>
333          * 
334          * <br>
335          * 
336          * @see CleanUpOptions#TRUE
337          * @see CleanUpOptions#FALSE
338          * @since 3.3
339          */
340         public static final String MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD= "cleanup.qualify_static_field_accesses_with_declaring_class"; //$NON-NLS-1$
341
342         /**
343          * Qualifies static method accesses with declaring type.
344          * <p>
345          * Example:
346          * 
347          * <pre>
348          *                   class E {
349          *                     public static int m();
350          *                     void foo() {m();} -&gt; void foo() {E.m();}
351          *                   }
352          * </pre>
353          * 
354          * Only has an effect if {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS} is TRUE <br>
355          * <br>
356          * Possible values: {TRUE, FALSE}<br>
357          * 
358          * <br>
359          * 
360          * @see CleanUpOptions#TRUE
361          * @see CleanUpOptions#FALSE
362          * @since 3.3
363          */
364         public static final String MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD= "cleanup.qualify_static_method_accesses_with_declaring_class"; //$NON-NLS-1$
365
366         /**
367          * Changes indirect accesses to static members to direct ones.
368          * <p>
369          * Example:
370          * 
371          * <pre>
372          *                   class E {public static int i;}
373          *                   class ESub extends E {
374          *                     void foo() {ESub.i= 10;} -&gt; void foo() {E.i= 10;}
375          *                   }
376          * </pre>
377          * 
378          * Only has an effect if {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS} is TRUE <br>
379          * <br>
380          * Possible values: {TRUE, FALSE}<br>
381          * 
382          * <br>
383          * 
384          * @see CleanUpOptions#TRUE
385          * @see CleanUpOptions#FALSE
386          * @since 3.3
387          */
388         public static final String MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS= "cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class"; //$NON-NLS-1$
389
390         /**
391          * Changes non static accesses to static members to static accesses.
392          * <p>
393          * Example:
394          * 
395          * <pre>
396          *                   class E {
397          *                     public static int i;
398          *                     void foo() {(new E()).i= 10;} -&gt; void foo() {E.i= 10;}
399          *                   }
400          * </pre>
401          * 
402          * Only has an effect if {@link #MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS} is TRUE <br>
403          * <br>
404          * Possible values: {TRUE, FALSE}<br>
405          * 
406          * <br>
407          * 
408          * @see CleanUpOptions#TRUE
409          * @see CleanUpOptions#FALSE
410          * @since 3.3
411          */
412         public static final String MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS= "cleanup.qualify_static_member_accesses_through_instances_with_declaring_class"; //$NON-NLS-1$
413
414         /**
415          * Controls the usage of blocks around single control statement bodies. For detailed settings
416          * use<br> {@link #CONTROL_STATMENTS_USE_BLOCKS_ALWAYS}<br> {@link #CONTROL_STATMENTS_USE_BLOCKS_NEVER}<br>
417          * {@link #CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW} <br>
418          * <br>
419          * Possible values: {TRUE, FALSE}<br>
420          * 
421          * <br>
422          * 
423          * @see CleanUpOptions#TRUE
424          * @see CleanUpOptions#FALSE
425          * @since 3.3
426          */
427         public static final String CONTROL_STATEMENTS_USE_BLOCKS= "cleanup.use_blocks"; //$NON-NLS-1$
428
429         /**
430          * Adds block to control statement body if the body is not a block.
431          * <p>
432          * Example:
433          * 
434          * <pre>
435          *                       if (b) foo(); -&gt; if (b) {foo();}
436          * </pre>
437          * 
438          * Only has an effect if {@link #CONTROL_STATEMENTS_USE_BLOCKS} is TRUE <br>
439          * <br>
440          * Possible values: {TRUE, FALSE}<br>
441          * 
442          * <br>
443          * 
444          * @see CleanUpOptions#TRUE
445          * @see CleanUpOptions#FALSE
446          * @since 3.3
447          */
448         public static final String CONTROL_STATMENTS_USE_BLOCKS_ALWAYS= "cleanup.always_use_blocks"; //$NON-NLS-1$
449
450         /**
451          * Remove unnecessary blocks in control statement bodies if they contain a single return or
452          * throw statement.
453          * <p>
454          * Example:
455          * 
456          * <pre>
457          *                     if (b) {return;} -&gt; if (b) return;
458          * </pre>
459          * 
460          * Only has an effect if {@link #CONTROL_STATEMENTS_USE_BLOCKS} is TRUE <br>
461          * <br>
462          * Possible values: {TRUE, FALSE}<br>
463          * 
464          * <br>
465          * 
466          * @see CleanUpOptions#TRUE
467          * @see CleanUpOptions#FALSE
468          * @since 3.3
469          */
470         public static final String CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW= "cleanup.use_blocks_only_for_return_and_throw"; //$NON-NLS-1$
471
472         /**
473          * Remove unnecessary blocks in control statement bodies.
474          * <p>
475          * Example:
476          * 
477          * <pre>
478          *                     if (b) {foo();} -&gt; if (b) foo();
479          * </pre>
480          * 
481          * Only has an effect if {@link #CONTROL_STATEMENTS_USE_BLOCKS} is TRUE <br>
482          * <br>
483          * Possible values: {TRUE, FALSE}<br>
484          * 
485          * <br>
486          * 
487          * @see CleanUpOptions#TRUE
488          * @see CleanUpOptions#FALSE
489          * @since 3.3
490          */
491         public static final String CONTROL_STATMENTS_USE_BLOCKS_NEVER= "cleanup.never_use_blocks"; //$NON-NLS-1$
492
493         /**
494          * Convert for loops to enhanced for loops.
495          * <p>
496          * Example:
497          * 
498          * <pre>
499          *                   for (int i = 0; i &lt; array.length; i++) {} -&gt; for (int element : array) {}
500          * </pre>
501          * 
502          * Possible values: {TRUE, FALSE}<br>
503          * 
504          * <br>
505          * 
506          * @see CleanUpOptions#TRUE
507          * @see CleanUpOptions#FALSE
508          * @since 3.3
509          */
510         public static final String CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED= "cleanup.convert_to_enhanced_for_loop"; //$NON-NLS-1$
511
512         /**
513          * Controls the usage of parentheses in expressions. For detailed settings use<br>
514          * {@link #EXPRESSIONS_USE_PARENTHESES_ALWAYS}<br> {@link #EXPRESSIONS_USE_PARENTHESES_NEVER}<br>
515          * <br>
516          * <br>
517          * Possible values: {TRUE, FALSE}<br>
518          * 
519          * <br>
520          * 
521          * @see CleanUpOptions#TRUE
522          * @see CleanUpOptions#FALSE
523          * @since 3.3
524          */
525         public static final String EXPRESSIONS_USE_PARENTHESES= "cleanup.use_parentheses_in_expressions"; //$NON-NLS-1$
526
527         /**
528          * Add paranoiac parentheses around conditional expressions.
529          * <p>
530          * Example:
531          * 
532          * <pre>
533          *                   boolean b= i &gt; 10 &amp;&amp; i &lt; 100 || i &gt; 20;
534          *                   -&gt;
535          *                   boolean b= ((i &gt; 10) &amp;&amp; (i &lt; 100)) || (i &gt; 20);
536          * </pre>
537          * 
538          * Only has an effect if {@link #EXPRESSIONS_USE_PARENTHESES} is TRUE <br>
539          * <br>
540          * Possible values: {TRUE, FALSE}<br>
541          * 
542          * <br>
543          * 
544          * @see CleanUpOptions#TRUE
545          * @see CleanUpOptions#FALSE
546          * @since 3.3
547          */
548         public static final String EXPRESSIONS_USE_PARENTHESES_ALWAYS= "cleanup.always_use_parentheses_in_expressions"; //$NON-NLS-1$
549
550         /**
551          * Remove unnecessary parenthesis around conditional expressions.
552          * <p>
553          * Example:
554          * 
555          * <pre>
556          *                   boolean b= ((i &gt; 10) &amp;&amp; (i &lt; 100)) || (i &gt; 20);
557          *                   -&gt;
558          *                   boolean b= i &gt; 10 &amp;&amp; i &lt; 100 || i &gt; 20;
559          * </pre>
560          * 
561          * Only has an effect if {@link #EXPRESSIONS_USE_PARENTHESES} is TRUE <br>
562          * <br>
563          * Possible values: {TRUE, FALSE}<br>
564          * 
565          * <br>
566          * 
567          * @see CleanUpOptions#TRUE
568          * @see CleanUpOptions#FALSE
569          * @since 3.3
570          */
571         public static final String EXPRESSIONS_USE_PARENTHESES_NEVER= "cleanup.never_use_parentheses_in_expressions"; //$NON-NLS-1$
572
573         /**
574          * Controls the usage of 'final' modifier for variable declarations. For detailed settings use:<br>
575          * {@link #VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES}<br>
576          * {@link #VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS}<br>
577          * {@link #VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS} <br>
578          * <br>
579          * Possible values: {TRUE, FALSE}<br>
580          * 
581          * <br>
582          * 
583          * @see CleanUpOptions#TRUE
584          * @see CleanUpOptions#FALSE
585          * @since 3.3
586          */
587         public static final String VARIABLE_DECLARATIONS_USE_FINAL= "cleanup.make_variable_declarations_final"; //$NON-NLS-1$
588
589         /**
590          * Add a final modifier to private fields where possible i.e.:
591          * 
592          * <pre>
593          *                   private int field= 0; -&gt; private final int field= 0;
594          * </pre>
595          * 
596          * Only has an effect if {@link #VARIABLE_DECLARATIONS_USE_FINAL} is TRUE <br>
597          * <br>
598          * Possible values: {TRUE, FALSE}<br>
599          * 
600          * <br>
601          * 
602          * @see CleanUpOptions#TRUE
603          * @see CleanUpOptions#FALSE
604          * @since 3.3
605          */
606         public static final String VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS= "cleanup.make_private_fields_final"; //$NON-NLS-1$
607
608         /**
609          * Add a final modifier to method parameters where possible i.e.:
610          * 
611          * <pre>
612          *                   void foo(int i) {} -&gt; void foo(final int i) {}
613          * </pre>
614          * 
615          * Only has an effect if {@link #VARIABLE_DECLARATIONS_USE_FINAL} is TRUE <br>
616          * <br>
617          * Possible values: {TRUE, FALSE}<br>
618          * 
619          * <br>
620          * 
621          * @see CleanUpOptions#TRUE
622          * @see CleanUpOptions#FALSE
623          * @since 3.3
624          */
625         public static final String VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS= "cleanup.make_parameters_final"; //$NON-NLS-1$
626
627         /**
628          * Add a final modifier to local variables where possible i.e.:
629          * 
630          * <pre>
631          *                   int i= 0; -&gt; final int i= 0;
632          * </pre>
633          * 
634          * Only has an effect if {@link #VARIABLE_DECLARATIONS_USE_FINAL} is TRUE <br>
635          * <br>
636          * Possible values: {TRUE, FALSE}<br>
637          * 
638          * <br>
639          * 
640          * @see CleanUpOptions#TRUE
641          * @see CleanUpOptions#FALSE
642          * @since 3.3
643          */
644         public static final String VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES= "cleanup.make_local_variable_final"; //$NON-NLS-1$
645
646         /**
647          * Adds type parameters to raw type references.
648          * <p>
649          * Example:
650          * 
651          * <pre>
652          *                   List l; -&gt; List&lt;Object&gt; l;
653          * </pre>
654          * 
655          * Possible values: {TRUE, FALSE}<br>
656          * Default value: Not set<br>
657          * <br>
658          * 
659          * @see CleanUpOptions#TRUE
660          * @see CleanUpOptions#FALSE
661          * @since 3.3
662          */
663         public static final String VARIABLE_DECLARATION_USE_TYPE_ARGUMENTS_FOR_RAW_TYPE_REFERENCES= "cleanup.use_arguments_for_raw_type_references"; //$NON-NLS-1$
664
665         /**
666          * Removes unused imports. <br>
667          * <br>
668          * Possible values: {TRUE, FALSE}<br>
669          * 
670          * <br>
671          * 
672          * @see CleanUpOptions#TRUE
673          * @see CleanUpOptions#FALSE
674          * @since 3.3
675          */
676         public static final String REMOVE_UNUSED_CODE_IMPORTS= "cleanup.remove_unused_imports"; //$NON-NLS-1$
677
678         /**
679          * Controls the removal of unused private members. For detailed settings use:<br>
680          * {@link #REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS}<br> {@link #REMOVE_UNUSED_CODE_PRIVATE_FELDS}<br>
681          * {@link #REMOVE_UNUSED_CODE_PRIVATE_METHODS}<br> {@link #REMOVE_UNUSED_CODE_PRIVATE_TYPES} <br>
682          * <br>
683          * Possible values: {TRUE, FALSE}<br>
684          * 
685          * <br>
686          * 
687          * @see CleanUpOptions#TRUE
688          * @see CleanUpOptions#FALSE
689          * @since 3.3
690          */
691         public static final String REMOVE_UNUSED_CODE_PRIVATE_MEMBERS= "cleanup.remove_unused_private_members"; //$NON-NLS-1$
692
693         /**
694          * Removes unused private types. <br>
695          * Only has an effect if {@link #REMOVE_UNUSED_CODE_PRIVATE_MEMBERS} is TRUE <br>
696          * <br>
697          * Possible values: {TRUE, FALSE}<br>
698          * 
699          * <br>
700          * 
701          * @see CleanUpOptions#TRUE
702          * @see CleanUpOptions#FALSE
703          * @since 3.3
704          */
705         public static final String REMOVE_UNUSED_CODE_PRIVATE_TYPES= "cleanup.remove_unused_private_types"; //$NON-NLS-1$
706
707         /**
708          * Removes unused private constructors. <br>
709          * Only has an effect if {@link #REMOVE_UNUSED_CODE_PRIVATE_MEMBERS} is TRUE <br>
710          * <br>
711          * Possible values: {TRUE, FALSE}<br>
712          * 
713          * <br>
714          * 
715          * @see CleanUpOptions#TRUE
716          * @see CleanUpOptions#FALSE
717          * @since 3.3
718          */
719         public static final String REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS= "cleanup.remove_private_constructors"; //$NON-NLS-1$
720
721         /**
722          * Removes unused private fields. <br>
723          * Only has an effect if {@link #REMOVE_UNUSED_CODE_PRIVATE_MEMBERS} is TRUE <br>
724          * <br>
725          * Possible values: {TRUE, FALSE}<br>
726          * 
727          * <br>
728          * 
729          * @see CleanUpOptions#TRUE
730          * @see CleanUpOptions#FALSE
731          * @since 3.3
732          */
733         public static final String REMOVE_UNUSED_CODE_PRIVATE_FELDS= "cleanup.remove_unused_private_fields"; //$NON-NLS-1$
734
735         /**
736          * Removes unused private methods. <br>
737          * Only has an effect if {@link #REMOVE_UNUSED_CODE_PRIVATE_MEMBERS} is TRUE <br>
738          * <br>
739          * Possible values: {TRUE, FALSE}<br>
740          * 
741          * <br>
742          * 
743          * @see CleanUpOptions#TRUE
744          * @see CleanUpOptions#FALSE
745          * @since 3.3
746          */
747         public static final String REMOVE_UNUSED_CODE_PRIVATE_METHODS= "cleanup.remove_unused_private_methods"; //$NON-NLS-1$
748
749         /**
750          * Removes unused local variables. <br>
751          * <br>
752          * Possible values: {TRUE, FALSE}<br>
753          * 
754          * <br>
755          * 
756          * @see CleanUpOptions#TRUE
757          * @see CleanUpOptions#FALSE
758          * @since 3.3
759          */
760         public static final String REMOVE_UNUSED_CODE_LOCAL_VARIABLES= "cleanup.remove_unused_local_variables"; //$NON-NLS-1$
761
762         /**
763          * Removes unused casts. <br>
764          * <br>
765          * Possible values: {TRUE, FALSE}<br>
766          * 
767          * <br>
768          * 
769          * @see CleanUpOptions#TRUE
770          * @see CleanUpOptions#FALSE
771          * @since 3.3
772          */
773         public static final String REMOVE_UNNECESSARY_CASTS= "cleanup.remove_unnecessary_casts"; //$NON-NLS-1$
774
775         /**
776          * Remove unnecessary '$NON-NLS$' tags.
777          * <p>
778          * Example:
779          * 
780          * <pre>
781          * String s; //$NON-NLS-1$ -&gt; String s;
782          * </pre>
783          * 
784          * <br>
785          * <br>
786          * Possible values: {TRUE, FALSE}<br>
787          * 
788          * <br>
789          * 
790          * @see CleanUpOptions#TRUE
791          * @see CleanUpOptions#FALSE
792          * @since 3.3
793          */
794         public static final String REMOVE_UNNECESSARY_NLS_TAGS= "cleanup.remove_unnecessary_nls_tags"; //$NON-NLS-1$
795
796         /**
797          * Controls whether missing annotations should be added to the code. For detailed settings use:<br>
798          * {@link #ADD_MISSING_ANNOTATIONS_DEPRECATED}<br> {@value #ADD_MISSING_ANNOTATIONS_OVERRIDE} <br>
799          * <br>
800          * Possible values: {TRUE, FALSE}<br>
801          * 
802          * <br>
803          * 
804          * @see CleanUpOptions#TRUE
805          * @see CleanUpOptions#FALSE
806          * @since 3.3
807          */
808         public static final String ADD_MISSING_ANNOTATIONS= "cleanup.add_missing_annotations"; //$NON-NLS-1$
809
810         /**
811          * Add '@Override' annotation in front of overriding methods.
812          * <p>
813          * Example:
814          * 
815          * <pre>
816          *                   class E1 {void foo();}
817          *                   class E2 extends E1 {
818          *                       void foo(); -&gt;  @Override void foo();
819          *                   }
820          * </pre>
821          * 
822          * Only has an effect if {@link #ADD_MISSING_ANNOTATIONS} is TRUE <br>
823          * <br>
824          * Possible values: {TRUE, FALSE}<br>
825          * 
826          * <br>
827          * 
828          * @see CleanUpOptions#TRUE
829          * @see CleanUpOptions#FALSE
830          * @since 3.3
831          */
832         public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE= "cleanup.add_missing_override_annotations"; //$NON-NLS-1$
833
834         /**
835          * Add '@Override' annotation in front of methods that override or implement a superinterface method.
836          * <p>
837          * Example:
838          * 
839          * <pre>
840          *                   interface I {void foo();}
841          *                   class E implements I {
842          *                       void foo(); -&gt;  @Override void foo();
843          *                   }
844          * </pre>
845          * 
846          * Only has an effect if {@link #ADD_MISSING_ANNOTATIONS} and {@link #ADD_MISSING_ANNOTATIONS_OVERRIDE} are TRUE and
847          * the compiler compliance is 1.6 or higher.<br>
848          * <br>
849          * Possible values: {TRUE, FALSE}<br>
850          * 
851          * <br>
852          * 
853          * @see CleanUpOptions#TRUE
854          * @see CleanUpOptions#FALSE
855          * @since 3.6
856          */
857         public static final String ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION= "cleanup.add_missing_override_annotations_interface_methods"; //$NON-NLS-1$
858         
859         /**
860          * Add '@Deprecated' annotation in front of deprecated members.
861          * <p>
862          * Example:
863          * 
864          * <pre>
865          *                         /**@deprecated* /
866          *                        int i;
867          *                    -&gt;
868          *                         /**@deprecated* /
869          *                         &#064;Deprecated
870          *                        int i;
871          * </pre>
872          * 
873          * Only has an effect if {@link #ADD_MISSING_ANNOTATIONS} is TRUE <br>
874          * <br>
875          * Possible values: {TRUE, FALSE}<br>
876          * 
877          * <br>
878          * 
879          * @see CleanUpOptions#TRUE
880          * @see CleanUpOptions#FALSE
881          * @since 3.3
882          */
883         public static final String ADD_MISSING_ANNOTATIONS_DEPRECATED= "cleanup.add_missing_deprecated_annotations"; //$NON-NLS-1$
884
885         /**
886          * Controls whether missing serial version ids should be added to the code. For detailed
887          * settings use:<br> {@link #ADD_MISSING_SERIAL_VERSION_ID_DEFAULT}<br>
888          * {@link #ADD_MISSING_SERIAL_VERSION_ID_GENERATED} <br>
889          * <br>
890          * Possible values: {TRUE, FALSE}<br>
891          * 
892          * <br>
893          * 
894          * @see CleanUpOptions#TRUE
895          * @see CleanUpOptions#FALSE
896          * @since 3.3
897          */
898         public static final String ADD_MISSING_SERIAL_VERSION_ID= "cleanup.add_serial_version_id"; //$NON-NLS-1$
899
900         /**
901          * Adds a generated serial version id to subtypes of java.io.Serializable and
902          * java.io.Externalizable
903          * 
904          * public class E implements Serializable {} -> public class E implements Serializable { private
905          * static final long serialVersionUID = 4381024239L; } <br>
906          * Only has an effect if {@link #ADD_MISSING_SERIAL_VERSION_ID} is TRUE <br>
907          * <br>
908          * Possible values: {TRUE, FALSE}<br>
909          * 
910          * <br>
911          * 
912          * @see CleanUpOptions#TRUE
913          * @see CleanUpOptions#FALSE
914          * @since 3.3
915          */
916         public static final String ADD_MISSING_SERIAL_VERSION_ID_GENERATED= "cleanup.add_generated_serial_version_id"; //$NON-NLS-1$
917
918         /**
919          * Adds a default serial version it to subtypes of java.io.Serializable and
920          * java.io.Externalizable
921          * 
922          * public class E implements Serializable {} -> public class E implements Serializable { private
923          * static final long serialVersionUID = 1L; } <br>
924          * Only has an effect if {@link #ADD_MISSING_SERIAL_VERSION_ID} is TRUE <br>
925          * <br>
926          * Possible values: {TRUE, FALSE}<br>
927          * 
928          * <br>
929          * 
930          * @see CleanUpOptions#TRUE
931          * @see CleanUpOptions#FALSE
932          * @since 3.3
933          */
934         public static final String ADD_MISSING_SERIAL_VERSION_ID_DEFAULT= "cleanup.add_default_serial_version_id"; //$NON-NLS-1$
935
936         /**
937          * Add '$NON-NLS$' tags to non externalized strings.
938          * <p>
939          * Example:
940          * 
941          * <pre>
942          *                       String s= &quot;&quot;; -&gt; String s= &quot;&quot;; //$NON-NLS-1$
943          * </pre>
944          * 
945          * <br>
946          * <br>
947          * Possible values: {TRUE, FALSE}<br>
948          * 
949          * <br>
950          * 
951          * @see CleanUpOptions#TRUE
952          * @see CleanUpOptions#FALSE
953          * @since 3.3
954          */
955         public static final String ADD_MISSING_NLS_TAGS= "cleanup.add_missing_nls_tags"; //$NON-NLS-1$
956
957         /**
958          * If true the imports are organized while cleaning up code.
959          * 
960          * Possible values: {TRUE, FALSE}<br>
961          * 
962          * <br>
963          * 
964          * @see CleanUpOptions#TRUE
965          * @see CleanUpOptions#FALSE
966          * @since 3.3
967          */
968         public static final String ORGANIZE_IMPORTS= "cleanup.organize_imports"; //$NON-NLS-1$
969
970         /**
971          * Should members be sorted? <br>
972          * <br>
973          * Possible values: {TRUE, FALSE}<br>
974          * 
975          * <br>
976          * 
977          * @see #SORT_MEMBERS_ALL
978          * @see CleanUpOptions#TRUE
979          * @see CleanUpOptions#FALSE
980          * @since 3.3
981          */
982         public static final String SORT_MEMBERS= "cleanup.sort_members"; //$NON-NLS-1$
983
984         /**
985          * If sorting members, should fields, enum constants and initializers also be sorted? <br>
986          * This has only an effect if {@link #SORT_MEMBERS} is also enabled. <br>
987          * <br>
988          * Possible values: {TRUE, FALSE}<br>
989          * 
990          * <br>
991          * 
992          * @see #SORT_MEMBERS
993          * @see CleanUpOptions#TRUE
994          * @see CleanUpOptions#FALSE
995          * @since 3.3
996          */
997         public static final String SORT_MEMBERS_ALL= "cleanup.sort_members_all"; //$NON-NLS-1$
998
999         /**
1000          * If enabled method stubs are added to all non abstract classes which require to implement some
1001          * methods. <br>
1002          * Possible values: {TRUE, FALSE}<br>
1003          * 
1004          * <br>
1005          * 
1006          * @see CleanUpOptions#TRUE
1007          * @see CleanUpOptions#FALSE
1008          * @since 3.4
1009          */
1010         public static final String ADD_MISSING_METHODES= "cleanup.add_missing_methods"; //$NON-NLS-1$
1011
1012         /**
1013          * Should the Clean Up Wizard be shown when executing the Clean Up Action? <br>
1014          * <br>
1015          * Possible values: {<code><b>true</b></code>, <code><b>false</b></code> <br>
1016          * Default value: <code><b>true</b></code><br>
1017          * <br>
1018          * 
1019          * @since 3.3
1020          */
1021         public static final String SHOW_CLEAN_UP_WIZARD= "cleanup.showwizard"; //$NON-NLS-1$
1022
1023         /**
1024          * A key to a serialized string in the <code>InstanceScope</code> containing all the profiles.<br>
1025          * Following code snippet can load the profiles:
1026          * 
1027          * <pre>
1028          * List profiles= new ProfileStore(CLEANUP_PROFILES, new CleanUpVersioner()).readProfiles(InstanceScope.INSTANCE);
1029          * </pre>
1030          * 
1031          * @since 3.3
1032          */
1033         public static final String CLEANUP_PROFILES= "org.eclipse.jdt.ui.cleanupprofiles"; //$NON-NLS-1$
1034
1035         /**
1036          * Stores the id of the clean up profile used when executing clean up.<br>
1037          * <br>
1038          * Possible values: String value<br>
1039          * Default value: {@link #DEFAULT_PROFILE} <br>
1040          * 
1041          * @since 3.3
1042          */
1043         public final static String CLEANUP_PROFILE= "cleanup_profile"; //$NON-NLS-1$$
1044
1045         /**
1046          * Stores the id of the clean up profile used when executing clean up on save.<br>
1047          * <br>
1048          * Possible values: String value<br>
1049          * Default value: {@link #DEFAULT_SAVE_PARTICIPANT_PROFILE} <br>
1050          * 
1051          * @since 3.3
1052          */
1053         public static final String CLEANUP_ON_SAVE_PROFILE= "cleanup.on_save_profile_id"; //$NON-NLS-1$
1054
1055         /**
1056          * A key to the version of the profile stored in the preferences.<br>
1057          * <br>
1058          * Possible values: Integer value<br>
1059          * Default value: {@link CleanUpProfileVersioner#CURRENT_VERSION} <br>
1060          * 
1061          * @since 3.3
1062          */
1063         public final static String CLEANUP_SETTINGS_VERSION_KEY= "cleanup_settings_version"; //$NON-NLS-1$
1064
1065         /**
1066          * Id of the 'Eclipse [built-in]' profile.<br>
1067          * <br>
1068          * 
1069          * @since 3.3
1070          */
1071         public final static String ECLIPSE_PROFILE= "org.eclipse.jdt.ui.default.eclipse_clean_up_profile"; //$NON-NLS-1$
1072
1073         /**
1074          * Id of the 'Save Participant [built-in]' profile.<br>
1075          * <br>
1076          * 
1077          * @since 3.3
1078          */
1079         public final static String SAVE_PARTICIPANT_PROFILE= "org.eclipse.jdt.ui.default.save_participant_clean_up_profile"; //$NON-NLS-1$
1080
1081         public static final String CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS= "cleanup.on_save_use_additional_actions"; //$NON-NLS-1$
1082
1083         /**
1084          * The id of the profile used as a default profile when executing clean up.<br>
1085          * <br>
1086          * Possible values: String value<br>
1087          * Default value: {@link #ECLIPSE_PROFILE} <br>
1088          * 
1089          * @since 3.3
1090          */
1091         public final static String DEFAULT_PROFILE= ECLIPSE_PROFILE;
1092
1093         /**
1094          * The id of the profile used as a default profile when executing clean up on save.<br>
1095          * <br>
1096          * Possible values: String value<br>
1097          * Default value: {@link #SAVE_PARTICIPANT_PROFILE} <br>
1098          * 
1099          * @since 3.3
1100          */
1101         public final static String DEFAULT_SAVE_PARTICIPANT_PROFILE= SAVE_PARTICIPANT_PROFILE;
1102
1103         private static void setEclipseDefaultSettings(CleanUpOptions options) {
1104
1105                 //Member Accesses
1106                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
1107                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
1108                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
1109
1110                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
1111                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
1112                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
1113
1114                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.TRUE);
1115                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
1116                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
1117                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
1118                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
1119
1120                 //Control Statements
1121                 options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
1122                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
1123                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
1124                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
1125
1126                 options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
1127
1128                 //Expressions
1129                 options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
1130                 options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
1131                 options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
1132
1133                 //Variable Declarations
1134                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.FALSE);
1135                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.TRUE);
1136                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
1137                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
1138
1139                 //Unused Code
1140                 options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.TRUE);
1141                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
1142                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
1143                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
1144                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
1145                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
1146                 options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
1147
1148                 //Unnecessary Code
1149                 options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
1150                 options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.TRUE);
1151
1152                 //Missing Code
1153                 options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
1154                 options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
1155                 options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
1156                 options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
1157
1158                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
1159                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
1160                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
1161
1162                 options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
1163
1164                 options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
1165                 options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
1166
1167                 //Code Organizing
1168                 options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
1169                 options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
1170
1171                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
1172                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
1173                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
1174
1175                 options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
1176
1177                 options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.FALSE);
1178
1179                 options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
1180                 options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
1181         }
1182
1183         private static void setSaveParticipantSettings(CleanUpOptions options) {
1184
1185                 //Member Accesses
1186                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpOptions.FALSE);
1187                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
1188                 options.setOption(MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
1189
1190                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpOptions.FALSE);
1191                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpOptions.FALSE);
1192                 options.setOption(MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpOptions.TRUE);
1193
1194                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpOptions.FALSE);
1195                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpOptions.FALSE);
1196                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpOptions.FALSE);
1197                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpOptions.TRUE);
1198                 options.setOption(MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpOptions.TRUE);
1199
1200                 //Control Statements
1201                 options.setOption(CONTROL_STATEMENTS_USE_BLOCKS, CleanUpOptions.FALSE);
1202                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpOptions.TRUE);
1203                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpOptions.FALSE);
1204                 options.setOption(CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpOptions.FALSE);
1205
1206                 options.setOption(CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpOptions.FALSE);
1207
1208                 //Expressions
1209                 options.setOption(EXPRESSIONS_USE_PARENTHESES, CleanUpOptions.FALSE);
1210                 options.setOption(EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpOptions.TRUE);
1211                 options.setOption(EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpOptions.FALSE);
1212
1213                 //Variable Declarations
1214                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL, CleanUpOptions.TRUE);
1215                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpOptions.FALSE);
1216                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpOptions.FALSE);
1217                 options.setOption(VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpOptions.TRUE);
1218
1219                 //Unused Code
1220                 options.setOption(REMOVE_UNUSED_CODE_IMPORTS, CleanUpOptions.FALSE);
1221                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpOptions.FALSE);
1222                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpOptions.TRUE);
1223                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpOptions.TRUE);
1224                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpOptions.TRUE);
1225                 options.setOption(REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpOptions.TRUE);
1226                 options.setOption(REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpOptions.FALSE);
1227
1228                 //Unnecessary Code
1229                 options.setOption(REMOVE_UNNECESSARY_CASTS, CleanUpOptions.TRUE);
1230                 options.setOption(REMOVE_UNNECESSARY_NLS_TAGS, CleanUpOptions.FALSE);
1231
1232                 //Missing Code
1233                 options.setOption(ADD_MISSING_ANNOTATIONS, CleanUpOptions.TRUE);
1234                 options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE, CleanUpOptions.TRUE);
1235                 options.setOption(ADD_MISSING_ANNOTATIONS_OVERRIDE_FOR_INTERFACE_METHOD_IMPLEMENTATION, CleanUpOptions.TRUE);
1236                 options.setOption(ADD_MISSING_ANNOTATIONS_DEPRECATED, CleanUpOptions.TRUE);
1237
1238                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID, CleanUpOptions.FALSE);
1239                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID_GENERATED, CleanUpOptions.FALSE);
1240                 options.setOption(ADD_MISSING_SERIAL_VERSION_ID_DEFAULT, CleanUpOptions.TRUE);
1241
1242                 options.setOption(ADD_MISSING_NLS_TAGS, CleanUpOptions.FALSE);
1243
1244                 options.setOption(ADD_MISSING_METHODES, CleanUpOptions.FALSE);
1245                 options.setOption(UnimplementedCodeCleanUp.MAKE_TYPE_ABSTRACT, CleanUpOptions.FALSE);
1246
1247                 //Code Organizing
1248                 options.setOption(FORMAT_SOURCE_CODE, CleanUpOptions.FALSE);
1249                 options.setOption(FORMAT_SOURCE_CODE_CHANGES_ONLY, CleanUpOptions.FALSE);
1250
1251                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES, CleanUpOptions.FALSE);
1252                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_ALL, CleanUpOptions.TRUE);
1253                 options.setOption(FORMAT_REMOVE_TRAILING_WHITESPACES_IGNORE_EMPTY, CleanUpOptions.FALSE);
1254
1255                 options.setOption(FORMAT_CORRECT_INDENTATION, CleanUpOptions.FALSE);
1256
1257                 options.setOption(ORGANIZE_IMPORTS, CleanUpOptions.TRUE);
1258
1259                 options.setOption(SORT_MEMBERS, CleanUpOptions.FALSE);
1260                 options.setOption(SORT_MEMBERS_ALL, CleanUpOptions.FALSE);
1261
1262                 options.setOption(CLEANUP_ON_SAVE_ADDITIONAL_OPTIONS, CleanUpOptions.FALSE);
1263         }
1264
1265         public static void initDefaults(IPreferenceStore store) {
1266                 CleanUpOptions settings= JavaPlugin.getDefault().getCleanUpRegistry().getDefaultOptions(CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS);
1267                 for (Iterator<String> iterator= settings.getKeys().iterator(); iterator.hasNext();) {
1268                         String key= iterator.next();
1269                         store.setDefault(key, settings.getValue(key));
1270                 }
1271
1272                 store.setDefault(SHOW_CLEAN_UP_WIZARD, true);
1273                 store.setDefault(CLEANUP_PROFILE, DEFAULT_PROFILE);
1274                 store.setDefault(CLEANUP_ON_SAVE_PROFILE, DEFAULT_SAVE_PARTICIPANT_PROFILE);
1275         }
1276
1277         public static void setDefaultOptions(int kind, CleanUpOptions options) {
1278                 switch (kind) {
1279                         case CleanUpConstants.DEFAULT_CLEAN_UP_OPTIONS:
1280                                 CleanUpConstants.setEclipseDefaultSettings(options);
1281                                 break;
1282                         case CleanUpConstants.DEFAULT_SAVE_ACTION_OPTIONS:
1283                                 CleanUpConstants.setSaveParticipantSettings(options);
1284                                 break;
1285                         default:
1286                                 Assert.isTrue(false, "Unknown Clean Up option kind: " + kind); //$NON-NLS-1$
1287                                 break;
1288                 }
1289         }
1290
1291 }