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

Fix C model corruption by resource to items mapping

This commit is contained in:
Anton Leherbauer 2008-06-19 11:28:26 +00:00
parent 2a14adcbbc
commit d65887df09

View file

@ -186,18 +186,15 @@ public class ResourceToItemsMapper {
private static IResource getCorrespondingResource(Object element) {
if (element instanceof ICElement) {
ICElement elem= (ICElement) element;
if (elem.exists()) {
IResource res= elem.getResource();
if (res == null) {
ITranslationUnit cu= (ITranslationUnit) elem.getAncestor(ICElement.C_UNIT);
if (cu != null) {
// elements in compilation units are mapped to the underlying resource of the original cu
res= cu.getResource();
}
IResource res= elem.getResource();
if (res == null) {
ITranslationUnit cu= (ITranslationUnit) elem.getAncestor(ICElement.C_UNIT);
if (cu != null) {
// elements in compilation units are mapped to the underlying resource of the original cu
res= cu.getResource();
}
return res;
}
return null;
return res;
} else if (element instanceof IResource) {
return (IResource) element;
}