diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewLabelProvider.java index 48037296140..cddcad6a2d8 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/cview/CViewLabelProvider.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.ui.cview; import org.eclipse.cdt.core.model.IIncludeReference; import org.eclipse.cdt.internal.ui.IAdornmentProvider; import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider; -import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; /* @@ -43,11 +42,11 @@ public class CViewLabelProvider extends StandardCElementLabelProvider { if (element instanceof IIncludeReference) { IIncludeReference ref = (IIncludeReference)element; Object parent = ref.getParent(); - if (!(parent instanceof IIncludeReference)) { + if (parent instanceof IIncludeReference) { IPath p = ref.getPath(); - IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); - if (rootLocation.isPrefixOf(p)) { - p = p.removeFirstSegments(rootLocation.segmentCount()); + IPath parentLocation = ((IIncludeReference)parent).getPath(); + if (parentLocation.isPrefixOf(p)) { + p = p.removeFirstSegments(parentLocation.segmentCount()); } return p.toString(); }