1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 161392, language computation for header files.

This commit is contained in:
Markus Schorn 2006-10-18 13:30:22 +00:00
parent 632d2457f7
commit d5bc2d7474
3 changed files with 7 additions and 19 deletions

View file

@ -24,8 +24,6 @@ import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SafeRunner;
@ -165,13 +163,11 @@ public class LanguageManager {
allTypes.add(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
IContentTypeManager manager = Platform.getContentTypeManager();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID, LANGUAGE_EXTENSION_POINT_ID);
IExtension[] extensions = point.getExtensions();
for (int i = 0; i < extensions.length; ++i) {
IConfigurationElement[] languages = extensions[i].getConfigurationElements();
for (int j = 0; j < languages.length; ++j) {
IConfigurationElement language = languages[j];
IConfigurationElement[] contentTypes = language.getChildren(ELEMENT_CONTENT_TYPE);
IConfigurationElement[] configs= Platform.getExtensionRegistry().getConfigurationElementsFor(LANGUAGE_EXTENSION_POINT_ID);
for (int j = 0; j < configs.length; ++j) {
final IConfigurationElement languageElem = configs[j];
if (ELEMENT_LANGUAGE.equals(languageElem.getName())) {
IConfigurationElement[] contentTypes = languageElem.getChildren(ELEMENT_CONTENT_TYPE);
for (int k = 0; k < contentTypes.length; ++k) {
IContentType langContType = manager.getContentType(contentTypes[k].getAttribute(ATTRIBUTE_ID));
allTypes.add(langContType.getId());

View file

@ -694,16 +694,6 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
public ILanguage getLanguage() throws CoreException {
if (language == null) {
language = computeLanguage(contentTypeId);
// Special magic for C/C++ header files
if (language == null && isHeaderUnit()) {
if (CCorePlugin.CONTENT_TYPE_CHEADER.equals(contentTypeId)) {
language = computeLanguage(CCorePlugin.CONTENT_TYPE_CSOURCE);
}
else if (CCorePlugin.CONTENT_TYPE_CXXHEADER.equals(contentTypeId)) {
language = computeLanguage(CCorePlugin.CONTENT_TYPE_CXXSOURCE);
}
}
}
return language;

View file

@ -560,12 +560,14 @@
id="gcc"
name="GNU C">
<contentType id="org.eclipse.cdt.core.cSource"/>
<contentType id="org.eclipse.cdt.core.cHeader"/>
</language>
<language
class="org.eclipse.cdt.core.dom.ast.gnu.cpp.GPPLanguage"
id="g++"
name="GNU C++">
<contentType id="org.eclipse.cdt.core.cxxSource"/>
<contentType id="org.eclipse.cdt.core.cxxHeader"/>
</language>
<pdomLinkageFactory
class="org.eclipse.cdt.internal.core.pdom.dom.c.PDOMCLinkageFactory"