private void loadStyle(IncludeKind includeKind, String preferenceKey, ICProject project) { String value = PreferenceConstants.getPreference(preferenceKey, project, null); IncludeGroupStyle style = null; if (value != null) style = IncludeGroupStyle.fromXmlString(value, includeKind); if (style == null) style = new IncludeGroupStyle(includeKind); includeStyles.put(includeKind, style); }
/** * Initializes the given preference store with the default values. * * @param store the preference store to be initialized */ public static void initializeDefaultValues(IPreferenceStore store) { IncludeGroupStyle style = new IncludeGroupStyle(IncludeKind.RELATED); store.setDefault(PreferenceConstants.INCLUDE_STYLE_RELATED, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.PARTNER); style.setKeepTogether(true); style.setBlankLineBefore(true); style.setOrder(0); store.setDefault(PreferenceConstants.INCLUDE_STYLE_PARTNER, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.IN_SAME_FOLDER); store.setDefault(PreferenceConstants.INCLUDE_STYLE_SAME_FOLDER, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.IN_SUBFOLDER); store.setDefault(PreferenceConstants.INCLUDE_STYLE_SUBFOLDER, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.SYSTEM); style.setKeepTogether(true); style.setBlankLineBefore(true); store.setDefault(PreferenceConstants.INCLUDE_STYLE_SYSTEM, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.SYSTEM_WITH_EXTENSION); style.setKeepTogether(true); style.setAngleBrackets(true); style.setOrder(1); store.setDefault(PreferenceConstants.INCLUDE_STYLE_SYSTEM_WITH_EXTENSION, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.SYSTEM_WITHOUT_EXTENSION); style.setKeepTogether(true); style.setAngleBrackets(true); style.setOrder(2); store.setDefault( PreferenceConstants.INCLUDE_STYLE_SYSTEM_WITHOUT_EXTENSION, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.OTHER); style.setKeepTogether(true); style.setBlankLineBefore(true); style.setOrder(3); store.setDefault(PreferenceConstants.INCLUDE_STYLE_OTHER, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.IN_SAME_PROJECT); store.setDefault(PreferenceConstants.INCLUDE_STYLE_SAME_PROJECT, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.IN_OTHER_PROJECT); store.setDefault(PreferenceConstants.INCLUDE_STYLE_OTHER_PROJECT, style.toXmlString()); style = new IncludeGroupStyle(IncludeKind.EXTERNAL); store.setDefault(PreferenceConstants.INCLUDE_STYLE_EXTERNAL, style.toXmlString()); store.setDefault(PreferenceConstants.INCLUDE_STYLE_MATCHING_PATTERN, ""); // $NON-NLS-1$ store.setDefault( PreferenceConstants.INCLUDES_PARTNER_FILE_SUFFIXES, DEFAULT_PARTNER_FILE_SUFFIXES); store.setDefault(PreferenceConstants.INCLUDES_HEURISTIC_HEADER_SUBSTITUTION, true); store.setDefault(PreferenceConstants.INCLUDES_ALLOW_REORDERING, true); store.setDefault(PreferenceConstants.INCLUDES_ALLOW_PARTNER_INDIRECT_INCLUSION, true); store.setDefault(PreferenceConstants.FORWARD_DECLARE_COMPOSITE_TYPES, true); store.setDefault(PreferenceConstants.FORWARD_DECLARE_ENUMS, false); store.setDefault(PreferenceConstants.FORWARD_DECLARE_FUNCTIONS, false); store.setDefault(PreferenceConstants.FORWARD_DECLARE_EXTERNAL_VARIABLES, false); store.setDefault(PreferenceConstants.FORWARD_DECLARE_TEMPLATES, false); store.setDefault(PreferenceConstants.FORWARD_DECLARE_NAMESPACE_ELEMENTS, true); store.setDefault( PreferenceConstants.INCLUDES_UNUSED_STATEMENTS_DISPOSITION, UnusedStatementDisposition.REMOVE.toString()); store.setDefault( PreferenceConstants.INCLUDES_HEADER_SUBSTITUTION, HeaderSubstitutionMap.serializeMaps(GCCHeaderSubstitutionMaps.getDefaultMaps())); store.setDefault( PreferenceConstants.INCLUDES_SYMBOL_EXPORTING_HEADERS, SymbolExportMap.serializeMaps( Collections.singletonList(GCCHeaderSubstitutionMaps.getSymbolExportMap()))); }