From dae6b185519772a5ad5cbbf5c9d5849cff3ed4b1 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Wed, 8 Sep 2004 20:56:55 +0000 Subject: [PATCH] Fix the label text of the folders --- .../cdt/internal/ui/cview/CViewLabelProvider.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 61a67cef148..22de5cc408d 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 @@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.ui.cview; import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.IIncludeReference; +import org.eclipse.cdt.core.model.ITranslationUnit; import org.eclipse.cdt.internal.ui.CElementImageProvider; import org.eclipse.cdt.internal.ui.IAdornmentProvider; import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider; @@ -65,6 +66,18 @@ public class CViewLabelProvider extends StandardCElementLabelProvider { } return p.toString(); } + } else if (element instanceof ITranslationUnit) { + ITranslationUnit unit = (ITranslationUnit)element; + Object parent = unit.getParent(); + if (parent instanceof IIncludeReference) { + IPath p = unit.getPath(); + IPath parentLocation = ((IIncludeReference)parent).getPath(); + if (parentLocation.isPrefixOf(p)) { + p = p.setDevice(null); + p = p.removeFirstSegments(parentLocation.segmentCount()); + } + return p.toString(); + } } return super.getText(element); }