summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-02-11 20:42:32 -0500
committerSergey Prigogin2012-02-11 20:42:32 -0500
commite65759e510832c7d7ec881fe74cfd00d5620231a (patch)
tree6eb6a693d9bf3c6dd2fbaf043e41a8ca8b6b5fcb
parentaa4eae00dd3a136b915bdfa5891965a66ee820f4 (diff)
downloadorg.eclipse.cdt-e65759e510832c7d7ec881fe74cfd00d5620231a.zip
org.eclipse.cdt-e65759e510832c7d7ec881fe74cfd00d5620231a.tar.gz
org.eclipse.cdt-e65759e510832c7d7ec881fe74cfd00d5620231a.tar.xz
UI for new code style preferences.
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/CodeStyleBlock.java39
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java6
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.properties10
3 files changed, 51 insertions, 4 deletions
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 fcd2964..6091216 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 97fa545..e283634 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 b7cf751..79381ab 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