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:
parent
be49f6a48f
commit
e53919a536
1 changed files with 8 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue