From d65887df0931a0f8e8ed96f3cc38c0d336c7fff2 Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Thu, 19 Jun 2008 11:28:26 +0000 Subject: [PATCH] Fix C model corruption by resource to items mapping --- .../internal/ui/util/ResourceToItemsMapper.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java index ffd8b2a5161..de2112f3b83 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/util/ResourceToItemsMapper.java @@ -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; }