1 11 package org.eclipse.jdt.internal.ui.preferences.cleanup; 12 13 import java.util.Map ; 14 15 import org.eclipse.swt.SWT; 16 import org.eclipse.swt.layout.GridData; 17 import org.eclipse.swt.widgets.Composite; 18 import org.eclipse.swt.widgets.Group; 19 20 import org.eclipse.jdt.internal.corext.fix.CleanUpConstants; 21 22 import org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUp; 23 import org.eclipse.jdt.internal.ui.fix.ICleanUp; 24 import org.eclipse.jdt.internal.ui.preferences.formatter.ModifyDialog; 25 26 public final class MemberAccessesTabPage extends CleanUpTabPage { 27 28 public MemberAccessesTabPage(ModifyDialog dialog, Map values) { 29 this(dialog, values, false); 30 } 31 32 public MemberAccessesTabPage(IModificationListener listener, Map values, boolean isSaveParticipantConfiguration) { 33 super(listener, values, isSaveParticipantConfiguration); 34 } 35 36 protected ICleanUp[] createPreviewCleanUps(Map values) { 37 return new ICleanUp[] { 38 new CodeStyleCleanUp(values) 39 }; 40 } 41 42 protected void doCreatePreferences(Composite composite, int numColumns) { 43 44 Group instanceGroup= createGroup(numColumns, composite, CleanUpMessages.MemberAccessesTabPage_GroupName_NonStaticAccesses); 45 46 final CheckboxPreference thisFieldPref= createCheckboxPref(instanceGroup, numColumns, CleanUpMessages.MemberAccessesTabPage_CheckboxName_FieldQualifier, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS, CleanUpModifyDialog.FALSE_TRUE); 47 48 Composite fieldComposite= new Composite(instanceGroup, SWT.NONE); 49 fieldComposite.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT)); 50 fieldComposite.setLayout(createGridLayout(3, false)); 51 fieldComposite.setFont(composite.getFont()); 52 53 intent(fieldComposite); 54 final RadioPreference thisFieldAlwaysPref= createRadioPref(fieldComposite, 1, CleanUpMessages.MemberAccessesTabPage_RadioName_AlwaysThisForFields, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_ALWAYS, CleanUpModifyDialog.FALSE_TRUE); 55 final RadioPreference thisFieldNecessaryPref= createRadioPref(fieldComposite, 1, CleanUpMessages.MemberAccessesTabPage_RadioName_NeverThisForFields, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_FIELD_USE_THIS_IF_NECESSARY, CleanUpModifyDialog.FALSE_TRUE); 56 registerSlavePreference(thisFieldPref, new RadioPreference[] {thisFieldAlwaysPref, thisFieldNecessaryPref}); 57 58 final CheckboxPreference thisMethodPref= createCheckboxPref(instanceGroup, numColumns, CleanUpMessages.MemberAccessesTabPage_CheckboxName_MethodQualifier, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS, CleanUpModifyDialog.FALSE_TRUE); 59 60 Composite methodComposite= new Composite(instanceGroup, SWT.NONE); 61 methodComposite.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT)); 62 methodComposite.setLayout(createGridLayout(3, false)); 63 methodComposite.setFont(composite.getFont()); 64 65 intent(methodComposite); 66 final RadioPreference thisMethodAlwaysPref= createRadioPref(methodComposite, 1, CleanUpMessages.MemberAccessesTabPage_RadioName_AlwaysThisForMethods, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_ALWAYS, CleanUpModifyDialog.FALSE_TRUE); 67 final RadioPreference thisMethodNecessaryPref= createRadioPref(methodComposite, 1, CleanUpMessages.MemberAccessesTabPage_RadioName_NeverThisForMethods, CleanUpConstants.MEMBER_ACCESSES_NON_STATIC_METHOD_USE_THIS_IF_NECESSARY, CleanUpModifyDialog.FALSE_TRUE); 68 registerSlavePreference(thisMethodPref, new RadioPreference[] {thisMethodAlwaysPref, thisMethodNecessaryPref}); 69 70 Group staticGroup= createGroup(numColumns, composite, CleanUpMessages.MemberAccessesTabPage_GroupName_StaticAccesses); 71 72 final CheckboxPreference staticMemberPref= createCheckboxPref(staticGroup, numColumns, CleanUpMessages.MemberAccessesTabPage_CheckboxName_QualifyWithDeclaringClass, CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS, CleanUpModifyDialog.FALSE_TRUE); 73 intent(staticGroup); 74 final CheckboxPreference staticFieldPref= createCheckboxPref(staticGroup, numColumns - 1, CleanUpMessages.MemberAccessesTabPage_CheckboxName_QualifyFieldWithDeclaringClass, CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_FIELD, CleanUpModifyDialog.FALSE_TRUE); 75 intent(staticGroup); 76 final CheckboxPreference staticMethodPref= createCheckboxPref(staticGroup, numColumns - 1, CleanUpMessages.MemberAccessesTabPage_CheckboxName_QualifyMethodWithDeclaringClass, CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_METHOD, CleanUpModifyDialog.FALSE_TRUE); 77 intent(staticGroup); 78 final CheckboxPreference accessesThroughSubtypesPref= createCheckboxPref(staticGroup, numColumns - 1, CleanUpMessages.MemberAccessesTabPage_CheckboxName_ChangeAccessesThroughSubtypes, CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_SUBTYPE_ACCESS, CleanUpModifyDialog.FALSE_TRUE); 79 intent(staticGroup); 80 final CheckboxPreference accessesThroughInstancesPref= createCheckboxPref(staticGroup, numColumns - 1, CleanUpMessages.MemberAccessesTabPage_CheckboxName_ChangeAccessesThroughInstances, CleanUpConstants.MEMBER_ACCESSES_STATIC_QUALIFY_WITH_DECLARING_CLASS_INSTANCE_ACCESS, CleanUpModifyDialog.FALSE_TRUE); 81 registerSlavePreference(staticMemberPref, new CheckboxPreference[] {staticFieldPref, staticMethodPref, accessesThroughSubtypesPref, accessesThroughInstancesPref}); 82 } 83 } 84 | Popular Tags |