diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeStyleBlock.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeStyleBlock.java index fcd29643ff2..609121633ce 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeStyleBlock.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeStyleBlock.java @@ -23,14 +23,21 @@ import org.eclipse.cdt.ui.PreferenceConstants; import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener; /** - * Configures C Editor typing preferences. + * Configures elements of C/C++ code style affecting refactoring. */ class CodeStyleBlock extends OptionsConfigurationBlock { - private static final Key CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = getCDTUIKey(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER); + private static final Key CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER = + getCDTUIKey(PreferenceConstants.CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER); + private static final Key FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT = + getCDTUIKey(PreferenceConstants.FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT); + private static final Key FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER = + getCDTUIKey(PreferenceConstants.FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER); private static Key[] getAllKeys() { return new Key[] { CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER, + FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT, + FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER, }; } @@ -52,6 +59,12 @@ class CodeStyleBlock extends OptionsConfigurationBlock { Composite composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_class_member_order); fillClassMemberOrderSection(composite); + composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_parameter_order); + fillFunctionParameterOrderSection(composite); + + composite = addSubsection(control, PreferencesMessages.CodeStyleBlock_function_output_parameter_style); + fillFunctionOutputParameterStyleSection(composite); + scrolled.setContent(control); final Point size= control.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolled.setMinSize(size.x, size.y); @@ -69,6 +82,28 @@ class CodeStyleBlock extends OptionsConfigurationBlock { CLASS_MEMBER_ASCENDING_VISIBILITY_ORDER, TRUE_FALSE, 0); } + private void fillFunctionParameterOrderSection(Composite composite) { + GridLayout layout= new GridLayout(); + layout.numColumns= 3; + composite.setLayout(layout); + + addRadioButton(composite, PreferencesMessages.CodeStyleBlock_input_output, + FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT, FALSE_TRUE, 0); + addRadioButton(composite, PreferencesMessages.CodeStyleBlock_output_input, + FUNCTION_OUTPUT_PARAMETERS_BEFORE_INPUT, TRUE_FALSE, 0); + } + + private void fillFunctionOutputParameterStyleSection(Composite composite) { + GridLayout layout= new GridLayout(); + layout.numColumns= 3; + composite.setLayout(layout); + + addRadioButton(composite, PreferencesMessages.CodeStyleBlock_pass_by_reference, + FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER, FALSE_TRUE, 0); + addRadioButton(composite, PreferencesMessages.CodeStyleBlock_pass_by_pointer, + FUNCTION_PASS_OUTPUT_PARAMETERS_BY_POINTER, TRUE_FALSE, 0); + } + @Override protected void validateSettings(Key changedKey, String oldValue, String newValue) { } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java index 97fa545a614..e2836348847 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java @@ -198,6 +198,12 @@ public final class PreferencesMessages extends NLS { public static String CodeStyleBlock_class_member_order; public static String CodeStyleBlock_public_private; public static String CodeStyleBlock_private_public; + public static String CodeStyleBlock_function_parameter_order; + public static String CodeStyleBlock_input_output; + public static String CodeStyleBlock_output_input; + public static String CodeStyleBlock_function_output_parameter_style; + public static String CodeStyleBlock_pass_by_reference; + public static String CodeStyleBlock_pass_by_pointer; public static String TodoTaskPreferencePage_title; public static String TodoTaskPreferencePage_description; diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties index b7cf751fbfe..79381abcfd8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties @@ -231,8 +231,14 @@ CodeFormatterPreferencePage_description=A&ctive profile: # Code Style CodeStylePreferencePage_title=Code Style CodeStyleBlock_class_member_order=Class member visiblity order: -CodeStyleBlock_public_private=P&ublic, protected, private -CodeStyleBlock_private_public=P&rivate, protected, public +CodeStyleBlock_public_private=Pu&blic, protected, private +CodeStyleBlock_private_public=Pri&vate, protected, public +CodeStyleBlock_function_parameter_order=Function parameter order: +CodeStyleBlock_input_output=&Input parameters first +CodeStyleBlock_output_input=&Output parameters first +CodeStyleBlock_function_output_parameter_style=Output parameters of C++ functions: +CodeStyleBlock_pass_by_reference=Pass by &reference +CodeStyleBlock_pass_by_pointer=Pass by poi&nter # Task tags. TodoTaskPreferencePage_title=Task Tags