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

bug 330750: Include path defined as ${workspace_loc} incorrectly displayed in Project Explorer view

Patch from Alex Freidin
This commit is contained in:
Andrew Gvozdev 2011-01-25 15:43:38 +00:00
parent d5b2a18e14
commit 64695227bf
2 changed files with 15 additions and 3 deletions

View file

@ -711,6 +711,8 @@ public class PathEntryTranslator {
result[0][i] = new Path(projName);
result[1][i] = valuePath;
} else if(pathVarPath.isRoot()){
result[1][i] = ResourcesPlugin.getWorkspace().getRoot().getLocation();
}
}
} else {

View file

@ -18,6 +18,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.swt.graphics.Image;
import org.eclipse.cdt.core.model.ICElement;
@ -28,6 +29,8 @@ import org.eclipse.cdt.ui.CDTSharedImages;
import org.eclipse.cdt.ui.CElementImageDescriptor;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.corext.util.Strings;
import org.eclipse.cdt.internal.ui.viewsupport.AppearanceAwareLabelProvider;
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
@ -62,7 +65,9 @@ public class CViewLabelProvider extends AppearanceAwareLabelProvider {
}
}
}
return containers[0].getFullPath().makeRelative().toString();
IPath p = containers[0].getFullPath();
p = (p.isRoot()) ? uriPathLocation : p.makeRelative();
return decorateText(p.toString(), element);
}
} else if (element instanceof IIncludeReference) {
IIncludeReference ref = (IIncludeReference)element;
@ -74,7 +79,7 @@ public class CViewLabelProvider extends AppearanceAwareLabelProvider {
p = p.setDevice(null);
p = p.removeFirstSegments(parentLocation.segmentCount());
}
return p.toString();
return decorateText(p.toString(), element);
}
} else if (element instanceof ITranslationUnit) {
ITranslationUnit unit = (ITranslationUnit)element;
@ -86,11 +91,16 @@ public class CViewLabelProvider extends AppearanceAwareLabelProvider {
p = p.setDevice(null);
p = p.removeFirstSegments(parentLocation.segmentCount());
}
return p.toString();
return decorateText(p.toString(), element);
}
}
return super.getText(element);
}
@Override
public StyledString getStyledText(Object element) {
return Strings.markLTR(new StyledString(getText(element)));
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)