1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

Bug 45203. A preference for forward-declaring external variables.

This commit is contained in:
Sergey Prigogin 2013-08-07 11:40:50 -07:00
parent d995ec8bbe
commit e2ef1d3d9f
4 changed files with 21 additions and 5 deletions

View file

@ -36,6 +36,7 @@ public class OrganizeIncludesBlock extends OptionsConfigurationBlock {
private static final Key KEY_FORWARD_DECLARE_COMPOSITE_TYPES = getCDTUIKey(PreferenceConstants.FORWARD_DECLARE_COMPOSITE_TYPES);
private static final Key KEY_FORWARD_DECLARE_ENUMS = getCDTUIKey(PreferenceConstants.FORWARD_DECLARE_ENUMS);
private static final Key KEY_FORWARD_DECLARE_FUNCTIONS = getCDTUIKey(PreferenceConstants.FORWARD_DECLARE_FUNCTIONS);
private static final Key KEY_FORWARD_DECLARE_EXTERNAL_VARIABLES = getCDTUIKey(IncludePreferences.FORWARD_DECLARE_EXTERNAL_VARIABLES);
private static final Key KEY_FORWARD_DECLARE_TEMPLATES = getCDTUIKey(PreferenceConstants.FORWARD_DECLARE_TEMPLATES);
private static final Key KEY_FORWARD_DECLARE_NAMESPACE_ELEMENTS = getCDTUIKey(PreferenceConstants.FORWARD_DECLARE_NAMESPACE_ELEMENTS);
@ -58,6 +59,7 @@ public class OrganizeIncludesBlock extends OptionsConfigurationBlock {
KEY_FORWARD_DECLARE_COMPOSITE_TYPES,
KEY_FORWARD_DECLARE_ENUMS,
KEY_FORWARD_DECLARE_FUNCTIONS,
KEY_FORWARD_DECLARE_EXTERNAL_VARIABLES,
KEY_FORWARD_DECLARE_TEMPLATES,
KEY_FORWARD_DECLARE_NAMESPACE_ELEMENTS,
};
@ -96,6 +98,9 @@ public class OrganizeIncludesBlock extends OptionsConfigurationBlock {
control = addCheckBox(composite, PreferencesMessages.OrganizeIncludesBlock_forward_declare_functions,
KEY_FORWARD_DECLARE_FUNCTIONS, TRUE_FALSE, 0);
LayoutUtil.setHorizontalSpan(control, 2);
control = addCheckBox(composite, PreferencesMessages.OrganizeIncludesBlock_forward_declare_external_variables,
KEY_FORWARD_DECLARE_EXTERNAL_VARIABLES, TRUE_FALSE, 0);
LayoutUtil.setHorizontalSpan(control, 2);
control = addCheckBox(composite, PreferencesMessages.OrganizeIncludesBlock_forward_declare_templates,
KEY_FORWARD_DECLARE_TEMPLATES, TRUE_FALSE, 0);
LayoutUtil.setHorizontalSpan(control, 2);

View file

@ -502,9 +502,10 @@ public final class PreferencesMessages extends NLS {
public static String OrganizeIncludesBlock_allow_reordering;
public static String OrganizeIncludesBlock_forward_declare_composite_types;
public static String OrganizeIncludesBlock_forward_declare_enums;
public static String OrganizeIncludesBlock_forward_declare_external_variables;
public static String OrganizeIncludesBlock_forward_declare_functions;
public static String OrganizeIncludesBlock_forward_declare_templates;
public static String OrganizeIncludesBlock_forward_declare_namespace_elements;
public static String OrganizeIncludesBlock_forward_declare_templates;
public static String OrganizeIncludesBlock_heuristic_header_substitution;
public static String OrganizeIncludesBlock_partner_indirect_inclusion;
public static String OrganizeIncludesBlock_unused_statements;

View file

@ -559,9 +559,10 @@ OrganizeIncludesPreferencePage_title= Organize Includes
OrganizeIncludesBlock_allow_reordering= Allow &reordering of includes
OrganizeIncludesBlock_forward_declare_composite_types= Forward declare &classes, structs and unions
OrganizeIncludesBlock_forward_declare_enums= Forward declare &enums when possible
OrganizeIncludesBlock_forward_declare_external_variables= Forward declare external &variables
OrganizeIncludesBlock_forward_declare_functions= Forward declare &functions
OrganizeIncludesBlock_forward_declare_templates= Forward declare &templates
OrganizeIncludesBlock_forward_declare_namespace_elements= Forward declare &namespace elements
OrganizeIncludesBlock_forward_declare_templates= Forward declare &templates
OrganizeIncludesBlock_heuristic_header_substitution= Allow &heuristic header file substitution
OrganizeIncludesBlock_partner_indirect_inclusion= Skip include if included by &partner header
OrganizeIncludesBlock_unused_statements= &Unused Includes and Forward Declarations:

View file

@ -45,7 +45,15 @@ public class IncludePreferences {
* {@link org.eclipse.cdt.internal.ui.refactoring.includes.SymbolExportMap}s.
*/
public static final String INCLUDES_SYMBOL_EXPORTING_HEADERS = "organizeIncludes.symbolExportingHeaders"; //$NON-NLS-1$
/**
* Whether external variables should be forward declared if possible.
*
* Example:
* extern int errno;
*
* @since 5.7
*/
public static final String FORWARD_DECLARE_EXTERNAL_VARIABLES = "forwardDeclare.externalVariables"; //$NON-NLS-1$
public static enum UnusedStatementDisposition { REMOVE, COMMENT_OUT, KEEP }
@ -57,8 +65,7 @@ public class IncludePreferences {
public final boolean forwardDeclareCompositeTypes;
public final boolean forwardDeclareEnums;
public final boolean forwardDeclareFunctions;
// TODO(sprigogin): Create a preference for this.
public final boolean forwardDeclareExternalVariables = false;
public final boolean forwardDeclareExternalVariables;
public final boolean forwardDeclareTemplates;
public final boolean forwardDeclareNamespaceElements;
public final UnusedStatementDisposition unusedStatementsDisposition;
@ -93,6 +100,8 @@ public class IncludePreferences {
PreferenceConstants.FORWARD_DECLARE_ENUMS, project, false);
forwardDeclareFunctions = PreferenceConstants.getPreference(
PreferenceConstants.FORWARD_DECLARE_FUNCTIONS, project, false);
forwardDeclareExternalVariables = PreferenceConstants.getPreference(
FORWARD_DECLARE_EXTERNAL_VARIABLES, project, false);
forwardDeclareTemplates = PreferenceConstants.getPreference(
PreferenceConstants.FORWARD_DECLARE_TEMPLATES, project, false);
forwardDeclareNamespaceElements = PreferenceConstants.getPreference(