KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > preferences > cleanup > UnnecessaryCodeTabPage


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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 package org.eclipse.jdt.internal.ui.preferences.cleanup;
12
13 import java.util.Map JavaDoc;
14
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.swt.widgets.Group;
17
18 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
19
20 import org.eclipse.jdt.internal.ui.fix.ICleanUp;
21 import org.eclipse.jdt.internal.ui.fix.StringCleanUp;
22 import org.eclipse.jdt.internal.ui.fix.UnnecessaryCodeCleanUp;
23 import org.eclipse.jdt.internal.ui.fix.UnusedCodeCleanUp;
24 import org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialog;
25
26 public final class UnnecessaryCodeTabPage extends CleanUpTabPage {
27     
28     public UnnecessaryCodeTabPage(ModifyDialog dialog, Map JavaDoc values) {
29         this(dialog, values, false);
30     }
31
32     public UnnecessaryCodeTabPage(IModificationListener listener, Map JavaDoc values, boolean isSaveParticipantConfiguration) {
33         super(listener, values, isSaveParticipantConfiguration);
34     }
35     
36     protected ICleanUp[] createPreviewCleanUps(Map JavaDoc values) {
37         return new ICleanUp[] {
38                 new UnusedCodeCleanUp(values),
39                 new UnnecessaryCodeCleanUp(values),
40                 new StringCleanUp(values)
41         };
42     }
43
44     protected void doCreatePreferences(Composite composite, int numColumns) {
45         
46         Group unusedCodeGroup= createGroup(5, composite, CleanUpMessages.UnnecessaryCodeTabPage_GroupName_UnusedCode);
47         
48         CheckboxPreference removeImports= createCheckboxPref(unusedCodeGroup, 5, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedImports, CleanUpConstants.REMOVE_UNUSED_CODE_IMPORTS, CleanUpModifyDialog.FALSE_TRUE);
49         registerPreference(removeImports);
50         
51         final CheckboxPreference unusedMembersPref= createCheckboxPref(unusedCodeGroup, 5, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedMembers, CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS, CleanUpModifyDialog.FALSE_TRUE);
52         intent(unusedCodeGroup);
53         final CheckboxPreference typesPref= createCheckboxPref(unusedCodeGroup, 1, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedTypes, CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_TYPES, CleanUpModifyDialog.FALSE_TRUE);
54         final CheckboxPreference constructorPref= createCheckboxPref(unusedCodeGroup, 1, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedConstructors, CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS, CleanUpModifyDialog.FALSE_TRUE);
55         final CheckboxPreference fieldsPref= createCheckboxPref(unusedCodeGroup, 1, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedFields, CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_FELDS, CleanUpModifyDialog.FALSE_TRUE);
56         final CheckboxPreference methodsPref= createCheckboxPref(unusedCodeGroup, 1, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedMethods, CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_METHODS, CleanUpModifyDialog.FALSE_TRUE);
57         registerSlavePreference(unusedMembersPref, new CheckboxPreference[] {typesPref, constructorPref, fieldsPref, methodsPref});
58                 
59         CheckboxPreference removeLocals= createCheckboxPref(unusedCodeGroup, numColumns, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnusedLocalVariables, CleanUpConstants.REMOVE_UNUSED_CODE_LOCAL_VARIABLES, CleanUpModifyDialog.FALSE_TRUE);
60         registerPreference(removeLocals);
61         
62         Group unnecessaryGroup= createGroup(numColumns, composite, CleanUpMessages.UnnecessaryCodeTabPage_GroupName_UnnecessaryCode);
63         
64         CheckboxPreference casts= createCheckboxPref(unnecessaryGroup, numColumns, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnnecessaryCasts, CleanUpConstants.REMOVE_UNNECESSARY_CASTS, CleanUpModifyDialog.FALSE_TRUE);
65         registerPreference(casts);
66         
67         CheckboxPreference nls= createCheckboxPref(unnecessaryGroup, numColumns, CleanUpMessages.UnnecessaryCodeTabPage_CheckboxName_UnnecessaryNLSTags, CleanUpConstants.REMOVE_UNNECESSARY_NLS_TAGS, CleanUpModifyDialog.FALSE_TRUE);
68         registerPreference(nls);
69     }
70
71 }
72
Popular Tags