33import java .io .File ;
44import java .net .URI ;
55import java .util .Collection ;
6+ import java .util .LinkedHashSet ;
67import java .util .LinkedList ;
78import java .util .List ;
89
3637 *
3738 */
3839public class ToolchainSettings implements IToolchainSettings {
39- private static final String EXTENSION_CPP = "cpp" ;
4040 private final List <ICLanguageSetting > languageSettings ;
4141 private final ICConfigurationDescription activeConfiguration ;
4242 private final IProject project ;
4343 private final IWorkspaceRoot root ;
44+ private static final String GCC_LANGUAGE_ID = "org.eclipse.cdt.core.gcc" ;
45+ private static final String GPP_LANGUAGE_ID = "org.eclipse.cdt.core.g++" ;
4446
4547 public ToolchainSettings (IProject project ) throws IllegalStateException {
4648 languageSettings = new LinkedList <ICLanguageSetting >();
@@ -67,13 +69,10 @@ public ToolchainSettings(IProject project) throws IllegalStateException {
6769 ICLanguageSetting [] allLanguageSettings = folderDescription
6870 .getLanguageSettings ();
6971
70- // fetch the include settings from the first tool which supports c
71- for (ICLanguageSetting languageSetting : allLanguageSettings ) {
72- String extensions [] = languageSetting .getSourceExtensions ();
73- for (String extension : extensions ) {
74- if (EXTENSION_CPP .equalsIgnoreCase (extension )) { //$NON-NLS-1$
75- languageSettings .add (languageSetting );
76- }
72+ for (ICLanguageSetting ls : allLanguageSettings ) {
73+ String id = ls .getLanguageId ();
74+ if (GCC_LANGUAGE_ID .equals (id ) || GPP_LANGUAGE_ID .equals (id )) {
75+ languageSettings .add (ls );
7776 }
7877 }
7978
@@ -161,7 +160,7 @@ protected Collection<File> resolveIncludePath(File includePath)
161160 * @return all include folders in a list
162161 */
163162 protected Collection <File > getIncludes (boolean onlyUserDefined ) {
164- Collection <File > paths = new LinkedList <File >();
163+ Collection <File > paths = new LinkedHashSet <File >();
165164 IWorkspaceRoot workspaceRoot = project .getWorkspace ().getRoot ();
166165 URI workspaceUri = workspaceRoot .getLocationURI ();
167166
0 commit comments