1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 07:35:24 +02:00

[184053] storing absolute path separately from the DataElement in DSToreHostFile so that when there is a deletion the mapped lookup will still work

This commit is contained in:
David McKnight 2007-04-26 14:25:22 +00:00
parent 2020cc540c
commit 918b9b28c1

View file

@ -38,11 +38,13 @@ public class DStoreHostFile implements IHostFile
protected DataElement _element;
protected boolean _isArchive;
protected String _absolutePath;
public DStoreHostFile(DataElement element)
{
_element = element;
_isArchive = internalIsArchive();
init();
_isArchive = internalIsArchive();
}
public DataElement getDataElement()
@ -233,33 +235,39 @@ public class DStoreHostFile implements IHostFile
public String getAbsolutePath()
{
return _absolutePath;
}
private void init()
{
// set the absolute path
String name = _element.getName();
if (name == null)
{
// this element is deleted
return ""; //$NON-NLS-1$
_absolutePath = ""; //$NON-NLS-1$
}
if (name.length() == 0)
else if (name.length() == 0)
{
return _element.getValue();
_absolutePath = _element.getValue();
}
String parentPath = getParentPath();
String type = _element.getType();
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
{
return name;
}
if (name.length() == 0)
{
return PathUtility.normalizeUnknown(parentPath);
}
else
{
return PathUtility.normalizeUnknown(parentPath + "/" + name); //$NON-NLS-1$
String parentPath = getParentPath();
String type = _element.getType();
if (type.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
{
_absolutePath = name;
}
else if (name.length() == 0)
{
_absolutePath = PathUtility.normalizeUnknown(parentPath);
}
else
{
_absolutePath = PathUtility.normalizeUnknown(parentPath + "/" + name); //$NON-NLS-1$
}
}
}