Search in sources :

Example 1 with ICIncludePathEntry

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

the class AbstractSettingsSynchroniser method setIncludes.

private void setIncludes(final ICConfigurationDescription conf, final NarBuildArtifact settings) throws CoreException {
    final ICLanguageSetting[] languageSettings = conf.getRootFolderDescription().getLanguageSettings();
    final List<ICIncludePathEntry> cIncludePathEntries = new ArrayList<ICIncludePathEntry>();
    for (final String path : settings.getCSettings().getIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, ICSettingEntry.LOCAL);
        cIncludePathEntries.add(includePath);
    }
    for (final String path : settings.getCSettings().getSystemIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, 0);
        cIncludePathEntries.add(includePath);
    }
    final List<ICIncludePathEntry> cppIncludePathEntries = new ArrayList<ICIncludePathEntry>();
    for (final String path : settings.getCppSettings().getIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, ICSettingEntry.LOCAL);
        cppIncludePathEntries.add(includePath);
    }
    for (final String path : settings.getCppSettings().getSystemIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, 0);
        cppIncludePathEntries.add(includePath);
    }
    final List<ICIncludePathEntry> commonIncludePathEntries = new ArrayList<ICIncludePathEntry>();
    for (final String path : settings.getJavahIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, ICSettingEntry.LOCAL);
        commonIncludePathEntries.add(includePath);
    }
    for (final String path : settings.getJavaIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(path, 0);
        commonIncludePathEntries.add(includePath);
    }
    for (final File f : settings.getDependencyIncludePaths()) {
        ICIncludePathEntry includePath = createIncludePathEntry(f.getPath(), 0);
        commonIncludePathEntries.add(includePath);
    }
    for (ICLanguageSetting setting : languageSettings) {
        final List<ICLanguageSettingEntry> l = setting.getSettingEntriesList(ICSettingEntry.INCLUDE_PATH);
        l.clear();
        l.addAll(commonIncludePathEntries);
        if (cppLanguageId.equals(setting.getLanguageId())) {
            l.addAll(cppIncludePathEntries);
        } else if (cLanguageId.equals(setting.getLanguageId())) {
            l.addAll(cIncludePathEntries);
        }
        setting.setSettingEntries(ICSettingEntry.INCLUDE_PATH, l);
    }
}
Also used : ICLanguageSettingEntry(org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry) ICIncludePathEntry(org.eclipse.cdt.core.settings.model.ICIncludePathEntry) ArrayList(java.util.ArrayList) File(java.io.File) ICLanguageSetting(org.eclipse.cdt.core.settings.model.ICLanguageSetting)

Aggregations

File (java.io.File)1 ArrayList (java.util.ArrayList)1 ICIncludePathEntry (org.eclipse.cdt.core.settings.model.ICIncludePathEntry)1 ICLanguageSetting (org.eclipse.cdt.core.settings.model.ICLanguageSetting)1 ICLanguageSettingEntry (org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry)1