1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

cleanup path display

This commit is contained in:
David Inglis 2004-05-13 14:38:42 +00:00
parent e789040647
commit bb13674e2f

View file

@ -124,8 +124,9 @@ class CPElementLabelProvider extends LabelProvider {
switch (cpentry.getEntryKind()) { switch (cpentry.getEntryKind()) {
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
{ {
StringBuffer str = new StringBuffer( ((IPath)cpentry.getAttribute(CPElement.LIBRARY)).toOSString()); IPath libPath = (IPath)cpentry.getAttribute(CPElement.LIBRARY);
addBaseString(cpentry, str); StringBuffer str = new StringBuffer();
addBaseString(libPath, cpentry, str);
addExport(cpentry, str); addExport(cpentry, str);
return str.toString(); return str.toString();
} }
@ -134,8 +135,8 @@ class CPElementLabelProvider extends LabelProvider {
case IPathEntry.CDT_INCLUDE : case IPathEntry.CDT_INCLUDE :
{ {
IPath incPath = ((IPath)cpentry.getAttribute(CPElement.INCLUDE)); IPath incPath = ((IPath)cpentry.getAttribute(CPElement.INCLUDE));
StringBuffer str = new StringBuffer(incPath.toOSString()); StringBuffer str = new StringBuffer();
addBaseString(cpentry, str); addBaseString(incPath, cpentry, str);
addExport(cpentry, str); addExport(cpentry, str);
return str.toString(); return str.toString();
} }
@ -143,7 +144,7 @@ class CPElementLabelProvider extends LabelProvider {
{ {
StringBuffer str = new StringBuffer((String)cpentry.getAttribute(CPElement.MACRO_NAME) + "=" //$NON-NLS-1$ StringBuffer str = new StringBuffer((String)cpentry.getAttribute(CPElement.MACRO_NAME) + "=" //$NON-NLS-1$
+ (String)cpentry.getAttribute(CPElement.MACRO_VALUE)); + (String)cpentry.getAttribute(CPElement.MACRO_VALUE));
addBaseString(cpentry, str); addBaseString(null, cpentry, str);
addExport(cpentry, str); addExport(cpentry, str);
return str.toString(); return str.toString();
} }
@ -188,9 +189,12 @@ class CPElementLabelProvider extends LabelProvider {
} }
} }
private void addBaseString(CPElement cpentry, StringBuffer str) { private void addBaseString(IPath endPath, CPElement cpentry, StringBuffer str) {
IPath baseRef = (IPath)cpentry.getAttribute(CPElement.BASE_REF); IPath baseRef = (IPath)cpentry.getAttribute(CPElement.BASE_REF);
if (!baseRef.isEmpty()) { if (!baseRef.isEmpty()) {
if (endPath != null) {
str.append(endPath.toOSString());
}
str.append(" - ("); //$NON-NLS-1$ str.append(" - ("); //$NON-NLS-1$
if (baseRef.isAbsolute()) { if (baseRef.isAbsolute()) {
// str.append("From project "); // str.append("From project ");
@ -210,10 +214,12 @@ class CPElementLabelProvider extends LabelProvider {
} else { } else {
IPath path = (IPath)cpentry.getAttribute(CPElement.BASE); IPath path = (IPath)cpentry.getAttribute(CPElement.BASE);
if (!path.isEmpty()) { if (!path.isEmpty()) {
if (!path.hasTrailingSeparator()) { if (endPath != null) {
path = path.addTrailingSeparator(); path = path.append(endPath);
} }
str.insert(0, path.toOSString()); str.insert(0, path.toOSString());
} else if (endPath != null) {
str.insert(0, endPath.toOSString());
} }
} }