From e53919a5364ee98f5220a4a9917e105e02c15605 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Wed, 28 Apr 2004 21:11:36 +0000 Subject: [PATCH] beautify getText() label for CView --- .../cdt/internal/ui/cview/CViewLabelProvider.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 d6b9dca9fb7..48037296140 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,6 +13,8 @@ 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; /* * CViewLabelProvider @@ -42,7 +44,12 @@ public class CViewLabelProvider extends StandardCElementLabelProvider { IIncludeReference ref = (IIncludeReference)element; Object parent = ref.getParent(); if (!(parent instanceof IIncludeReference)) { - return ref.getPath().toString(); + IPath p = ref.getPath(); + IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); + if (rootLocation.isPrefixOf(p)) { + p = p.removeFirstSegments(rootLocation.segmentCount()); + } + return p.toString(); } } return super.getText(element);