1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

beautify getText() label for CView

This commit is contained in:
Alain Magloire 2004-04-28 21:11:36 +00:00
parent be49f6a48f
commit e53919a536

View file

@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.ui.cview;
import org.eclipse.cdt.core.model.IIncludeReference; import org.eclipse.cdt.core.model.IIncludeReference;
import org.eclipse.cdt.internal.ui.IAdornmentProvider; import org.eclipse.cdt.internal.ui.IAdornmentProvider;
import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider; import org.eclipse.cdt.internal.ui.StandardCElementLabelProvider;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
/* /*
* CViewLabelProvider * CViewLabelProvider
@ -42,7 +44,12 @@ public class CViewLabelProvider extends StandardCElementLabelProvider {
IIncludeReference ref = (IIncludeReference)element; IIncludeReference ref = (IIncludeReference)element;
Object parent = ref.getParent(); Object parent = ref.getParent();
if (!(parent instanceof IIncludeReference)) { 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); return super.getText(element);