mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Scanner info provider to supply scanner info for headers
This commit is contained in:
parent
0847bf37d8
commit
8b235273b5
2 changed files with 10 additions and 5 deletions
|
@ -229,14 +229,19 @@ public class LanguageSettingsManager {
|
||||||
if (resource instanceof IFile) {
|
if (resource instanceof IFile) {
|
||||||
String langId = null;
|
String langId = null;
|
||||||
if (cfgDescription != null) {
|
if (cfgDescription != null) {
|
||||||
|
// Inquire MBS
|
||||||
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(prjRelPath, true);
|
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(prjRelPath, true);
|
||||||
if (ls != null) {
|
if (ls != null) {
|
||||||
langId = ls.getLanguageId();
|
langId = ls.getLanguageId();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if (langId == null) {
|
||||||
|
// Try getting language from content types
|
||||||
try {
|
try {
|
||||||
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource, null);
|
ILanguage lang = LanguageManager.getInstance().getLanguageForFile((IFile) resource, cfgDescription);
|
||||||
langId = lang.getId();
|
if (lang != null) {
|
||||||
|
langId = lang.getId();
|
||||||
|
}
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CCorePlugin.log(e);
|
CCorePlugin.log(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.cdt.internal.core.settings.model.SettingsModelMessages;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -70,7 +69,8 @@ public class LanguageSettingsScannerInfoProvider implements IScannerInfoProvider
|
||||||
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
List<String> languageIds = LanguageSettingsManager.getLanguages(rc, cfgDescription);
|
||||||
if (languageIds.isEmpty()) {
|
if (languageIds.isEmpty()) {
|
||||||
String msg = NLS.bind(SettingsModelMessages.getString("LanguageSettingsScannerInfoProvider.UnableToDetermineLanguage"), rc.toString()); //$NON-NLS-1$
|
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;
|
return DUMMY_SCANNER_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue