Hi all,
I'm currently trying to add own macro definitions by using the follwoing API:
ICLanguageSetting.setSettingEntries(ICSettingEntry.MACRO, myMacros)
However, it does not work for me, i.e. the macro entries are not set at all. Inside setSettingEntries(..) the condition in
if((kind & eKind) != 0 && (data.getSupportedEntryKinds() & eKind) != 0){
store.addEntry(entry);
}
is never true because data.getSupportedEntryKinds() returns 48 => only ICSettingEntry.LIBRARY_PATH and ICSettingEntry.LIBRARY_FILE is supported. How can I change this? My observation is that, when running my product the attribute 'data' is of type BuildLanguageData. But, when running a JUnit test where I programmatically create a new C project, 'data' is of type CDefaultLanguageData. There, adding new macros works fine.
My code basically looks as following:
final ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
final ICProjectDescription des = mngr.getProjectDescription(file.getProject(), true);
final ICConfigurationDescription confDes = des.getDefaultSettingConfiguration();
final ICFolderDescription folderDescription = confDes.getRootFolderDescription();
final ICLanguageSetting[] languageSettings = folderDescription.getLanguageSettings();
for (final ICLanguageSetting lang : languageSettings) {
lang.setSettingEntries(ICSettingEntry.MACRO, macroDefines);
}
des.setActiveConfiguration(confDes);
des.setCdtProjectCreated();
model.setProjectDescription(file.getProject(), des);
Any idea what I am missing here?
Regards,
Thomas