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

Fix the label text of the folders

This commit is contained in:
Alain Magloire 2004-09-08 20:56:55 +00:00
parent 8923349603
commit dae6b18551

View file

@ -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);
}