mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52: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:
parent
932ec1f202
commit
47f54464d3
2 changed files with 5 additions and 6 deletions
|
@ -76,6 +76,10 @@ public class PDOMTypeReference implements ITypeReference {
|
|||
}
|
||||
|
||||
public ITranslationUnit getTranslationUnit() {
|
||||
ICElement element = CoreModel.getDefault().create(path);
|
||||
if (element != null && element instanceof ITranslationUnit)
|
||||
return (ITranslationUnit)element;
|
||||
else
|
||||
return CoreModel.getDefault().createTranslationUnitFrom(project, path);
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Add table
Reference in a new issue