1 11 package org.eclipse.jdt.internal.ui.preferences.cleanup; 12 13 import java.util.Map ; 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.ControlStatementsCleanUp; 21 import org.eclipse.jdt.internal.ui.fix.ConvertLoopCleanUp; 22 import org.eclipse.jdt.internal.ui.fix.ExpressionsCleanUp; 23 import org.eclipse.jdt.internal.ui.fix.ICleanUp; 24 import org.eclipse.jdt.internal.ui.fix.VariableDeclarationCleanUp; 25 import org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialog; 26 27 public final class CodeStyleTabPage extends CleanUpTabPage { 28 29 public CodeStyleTabPage(ModifyDialog dialog, Map values) { 30 this(dialog, values, false); 31 } 32 33 public CodeStyleTabPage(IModificationListener listener, Map values, boolean isSaveParticipantConfiguration) { 34 super(listener, values, isSaveParticipantConfiguration); 35 } 36 37 protected ICleanUp[] createPreviewCleanUps(Map values) { 38 return new ICleanUp[] { 39 new ControlStatementsCleanUp(values), 40 new ConvertLoopCleanUp(values), 41 new ExpressionsCleanUp(values), 42 new VariableDeclarationCleanUp(values) 43 }; 44 } 45 46 protected void doCreatePreferences(Composite composite, int numColumns) { 47 48 Group controlGroup= createGroup(numColumns, composite, CleanUpMessages.CodeStyleTabPage_GroupName_ControlStatments); 49 50 final CheckboxPreference useBlockPref= createCheckboxPref(controlGroup, numColumns, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseBlocks, CleanUpConstants.CONTROL_STATEMENTS_USE_BLOCKS, CleanUpModifyDialog.FALSE_TRUE); 51 intent(controlGroup); 52 final RadioPreference useBlockAlwaysPref= createRadioPref(controlGroup, numColumns - 1, CleanUpMessages.CodeStyleTabPage_RadioName_AlwaysUseBlocks, CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_ALWAYS, CleanUpModifyDialog.FALSE_TRUE); 53 intent(controlGroup); 54 final RadioPreference useBlockJDTStylePref= createRadioPref(controlGroup, numColumns - 1, CleanUpMessages.CodeStyleTabPage_RadioName_UseBlocksSpecial, CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NO_FOR_RETURN_AND_THROW, CleanUpModifyDialog.FALSE_TRUE); 55 intent(controlGroup); 56 final RadioPreference useBlockNeverPref= createRadioPref(controlGroup, numColumns - 1, CleanUpMessages.CodeStyleTabPage_RadioName_NeverUseBlocks, CleanUpConstants.CONTROL_STATMENTS_USE_BLOCKS_NEVER, CleanUpModifyDialog.FALSE_TRUE); 57 registerSlavePreference(useBlockPref, new RadioPreference[] {useBlockAlwaysPref, useBlockJDTStylePref, useBlockNeverPref}); 58 59 CheckboxPreference convertLoop= createCheckboxPref(controlGroup, numColumns, CleanUpMessages.CodeStyleTabPage_CheckboxName_ConvertForLoopToEnhanced, CleanUpConstants.CONTROL_STATMENTS_CONVERT_FOR_LOOP_TO_ENHANCED, CleanUpModifyDialog.FALSE_TRUE); 60 registerPreference(convertLoop); 61 62 Group expressionsGroup= createGroup(numColumns, composite, CleanUpMessages.CodeStyleTabPage_GroupName_Expressions); 63 64 final CheckboxPreference useParenthesesPref= createCheckboxPref(expressionsGroup, numColumns, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseParentheses, CleanUpConstants.EXPRESSIONS_USE_PARENTHESES, CleanUpModifyDialog.FALSE_TRUE); 65 intent(expressionsGroup); 66 final RadioPreference useParenthesesAlwaysPref= createRadioPref(expressionsGroup, 1, CleanUpMessages.CodeStyleTabPage_RadioName_AlwaysUseParantheses, CleanUpConstants.EXPRESSIONS_USE_PARENTHESES_ALWAYS, CleanUpModifyDialog.FALSE_TRUE); 67 final RadioPreference useParenthesesNeverPref= createRadioPref(expressionsGroup, 1, CleanUpMessages.CodeStyleTabPage_RadioName_NeverUseParantheses, CleanUpConstants.EXPRESSIONS_USE_PARENTHESES_NEVER, CleanUpModifyDialog.FALSE_TRUE); 68 registerSlavePreference(useParenthesesPref, new RadioPreference[] {useParenthesesAlwaysPref, useParenthesesNeverPref}); 69 70 Group variableGroup= createGroup(numColumns, composite, CleanUpMessages.CodeStyleTabPage_GroupName_VariableDeclarations); 71 72 final CheckboxPreference useFinalPref= createCheckboxPref(variableGroup, numColumns, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseFinal, CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL, CleanUpModifyDialog.FALSE_TRUE); 73 intent(variableGroup); 74 final CheckboxPreference useFinalFieldsPref= createCheckboxPref(variableGroup, 1, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseFinalForFields, CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PRIVATE_FIELDS, CleanUpModifyDialog.FALSE_TRUE); 75 final CheckboxPreference useFinalParametersPref= createCheckboxPref(variableGroup, 1, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseFinalForParameters, CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_PARAMETERS, CleanUpModifyDialog.FALSE_TRUE); 76 final CheckboxPreference useFinalVariablesPref= createCheckboxPref(variableGroup, 1, CleanUpMessages.CodeStyleTabPage_CheckboxName_UseFinalForLocals, CleanUpConstants.VARIABLE_DECLARATIONS_USE_FINAL_LOCAL_VARIABLES, CleanUpModifyDialog.FALSE_TRUE); 77 registerSlavePreference(useFinalPref, new CheckboxPreference[] {useFinalFieldsPref, useFinalParametersPref, useFinalVariablesPref}); 78 } 79 } 80 | Popular Tags |