1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix 151229 - Two problems here. First the CSourceViewer wasn't reacting well to files that we didn't know the content type for (rare case, though). The other was the PDOMTypeReference was always returning an external translation unit. Fixed to call the correct CModel create method.

This commit is contained in:
Doug Schaefer 2006-07-20 19:50:04 +00:00
parent 932ec1f202
commit 47f54464d3
2 changed files with 5 additions and 6 deletions

View file

@ -76,7 +76,11 @@ public class PDOMTypeReference implements ITypeReference {
}
public ITranslationUnit getTranslationUnit() {
return CoreModel.getDefault().createTranslationUnitFrom(project, path);
ICElement element = CoreModel.getDefault().create(path);
if (element != null && element instanceof ITranslationUnit)
return (ITranslationUnit)element;
else
return CoreModel.getDefault().createTranslationUnitFrom(project, path);
}
public IWorkingCopy getWorkingCopy() {

View file

@ -96,11 +96,6 @@ public class CSourceViewer extends ProjectionViewer implements ITextViewerExtens
IFile file = ResourceUtil.getFile(input);
if (file != null) {
contentType = CCorePlugin.getContentType(file.getProject(), file.getName());
try {
return LanguageManager.getInstance().getLanguage(contentType);
} catch (CoreException exc) {
CUIPlugin.getDefault().log(exc.getStatus());
}
} else if (input instanceof IPathEditorInput) {
IPath path = ((IPathEditorInput)input).getPath();
contentType = CCorePlugin.getContentType(path.lastSegment());