1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

FIx in the CViewLabel to not show the full includeReference paths

This commit is contained in:
Alain Magloire 2004-04-30 22:50:56 +00:00
parent 3fa86e4cce
commit a075f3082c

View file

@ -13,7 +13,6 @@ 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; import org.eclipse.core.runtime.IPath;
/* /*
@ -43,11 +42,11 @@ public class CViewLabelProvider extends StandardCElementLabelProvider {
if (element instanceof IIncludeReference) { if (element instanceof IIncludeReference) {
IIncludeReference ref = (IIncludeReference)element; IIncludeReference ref = (IIncludeReference)element;
Object parent = ref.getParent(); Object parent = ref.getParent();
if (!(parent instanceof IIncludeReference)) { if (parent instanceof IIncludeReference) {
IPath p = ref.getPath(); IPath p = ref.getPath();
IPath rootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); IPath parentLocation = ((IIncludeReference)parent).getPath();
if (rootLocation.isPrefixOf(p)) { if (parentLocation.isPrefixOf(p)) {
p = p.removeFirstSegments(rootLocation.segmentCount()); p = p.removeFirstSegments(parentLocation.segmentCount());
} }
return p.toString(); return p.toString();
} }