1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Scanner info provider to supply scanner info for headers

This commit is contained in:
Andrew Gvozdev 2011-12-20 11:35:36 -05:00
parent 0847bf37d8
commit 8b235273b5
2 changed files with 10 additions and 5 deletions

View file

@ -229,14 +229,19 @@ public class LanguageSettingsManager {
if (resource instanceof IFile) {
String langId = null;
if (cfgDescription != null) {
// Inquire MBS
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(prjRelPath, true);
if (ls != null) {
langId = ls.getLanguageId();
}
} else {
}
if (langId == null) {
// Try getting language from content types
try {
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource, null);
langId = lang.getId();
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource, cfgDescription);
if (lang != null) {
langId = lang.getId();
}
} catch (CoreException e) {
CCorePlugin.log(e);
}

View file

@ -34,7 +34,6 @@ import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager;
import org.eclipse.cdt.internal.core.settings.model.SettingsModelMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@ -70,7 +69,8 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, cfgDescription);
if (languageIds.isEmpty()) {
String msg = NLS.bind(SettingsModelMessages.getString("LanguageSettingsScannerInfoProvider.UnableToDetermineLanguage"), rc.toString()); //$NON-NLS-1$
CCorePlugin.log(new CoreException(new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, msg)));
IStatus status = new Status(IStatus.WARNING, CCorePlugin.PLUGIN_ID, msg, new Exception());
CCorePlugin.log(status);
return DUMMY_SCANNER_INFO;
}