mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Fixed up handling of header files to check the nature of the project.
This commit is contained in:
parent
e39bead08b
commit
0017da7863
2 changed files with 9 additions and 1 deletions
|
@ -17,6 +17,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.IBuffer;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.IInclude;
|
||||
|
@ -660,6 +661,14 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
|
|||
IContentTypeManager manager = Platform.getContentTypeManager();
|
||||
IContentType contentType = manager.getContentType(contentTypeId);
|
||||
language = LanguageManager.getInstance().getLanguage(contentType);
|
||||
|
||||
// Special magic for C/C++ header files
|
||||
if (language == null && isHeaderUnit()) {
|
||||
contentType = CoreModel.hasCCNature(getResource().getProject())
|
||||
? manager.getContentType(CCorePlugin.CONTENT_TYPE_CXXSOURCE)
|
||||
: manager.getContentType(CCorePlugin.CONTENT_TYPE_CSOURCE);
|
||||
language = LanguageManager.getInstance().getLanguage(contentType);
|
||||
}
|
||||
}
|
||||
|
||||
return language;
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
|
|
Loading…
Add table
Reference in a new issue