Search in sources :

Example 1 with ICMacroEntry

use of org.eclipse.cdt.core.settings.model.ICMacroEntry in project m2e-nar by maven-nar.

the class AbstractSettingsSynchroniser method setDefinedSymbols.

private void setDefinedSymbols(final ICConfigurationDescription conf, final NarBuildArtifact settings) throws CoreException {
    final ICLanguageSetting[] languageSettings = conf.getRootFolderDescription().getLanguageSettings();
    final List<ICMacroEntry> cMacroEntries = new ArrayList<ICMacroEntry>();
    for (final String define : settings.getCSettings().getDefines()) {
        final String escapedDefine = CdtUtils.escapeOption(define);
        ICMacroEntry macroEntry = createMacroEntry(escapedDefine, 0);
        cMacroEntries.add(macroEntry);
    }
    final List<ICMacroEntry> cppMacroEntries = new ArrayList<ICMacroEntry>();
    for (final String define : settings.getCppSettings().getDefines()) {
        final String escapedDefine = CdtUtils.escapeOption(define);
        ICMacroEntry macroEntry = createMacroEntry(escapedDefine, 0);
        cppMacroEntries.add(macroEntry);
    }
    for (ICLanguageSetting setting : languageSettings) {
        final List<ICLanguageSettingEntry> l = setting.getSettingEntriesList(ICSettingEntry.MACRO);
        l.clear();
        if (cppLanguageId.equals(setting.getLanguageId())) {
            l.addAll(cppMacroEntries);
        } else if (cLanguageId.equals(setting.getLanguageId())) {
            l.addAll(cMacroEntries);
        }
        setting.setSettingEntries(ICSettingEntry.MACRO, l);
    }
}
Also used : ICLanguageSettingEntry(org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry) ArrayList(java.util.ArrayList) ICMacroEntry(org.eclipse.cdt.core.settings.model.ICMacroEntry) ICLanguageSetting(org.eclipse.cdt.core.settings.model.ICLanguageSetting)

Aggregations

ArrayList (java.util.ArrayList)1 ICLanguageSetting (org.eclipse.cdt.core.settings.model.ICLanguageSetting)1 ICLanguageSettingEntry (org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry)1 ICMacroEntry (org.eclipse.cdt.core.settings.model.ICMacroEntry)1