mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 18:35:32 +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:
parent
2020cc540c
commit
918b9b28c1
1 changed files with 26 additions and 18 deletions
|
@ -38,10 +38,12 @@ public class DStoreHostFile implements IHostFile
|
||||||
|
|
||||||
protected DataElement _element;
|
protected DataElement _element;
|
||||||
protected boolean _isArchive;
|
protected boolean _isArchive;
|
||||||
|
protected String _absolutePath;
|
||||||
|
|
||||||
public DStoreHostFile(DataElement element)
|
public DStoreHostFile(DataElement element)
|
||||||
{
|
{
|
||||||
_element = element;
|
_element = element;
|
||||||
|
init();
|
||||||
_isArchive = internalIsArchive();
|
_isArchive = internalIsArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,32 +236,38 @@ public class DStoreHostFile implements IHostFile
|
||||||
|
|
||||||
public String getAbsolutePath()
|
public String getAbsolutePath()
|
||||||
{
|
{
|
||||||
|
return _absolutePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init()
|
||||||
|
{
|
||||||
|
// set the absolute path
|
||||||
String name = _element.getName();
|
String name = _element.getName();
|
||||||
if (name == null)
|
if (name == null)
|
||||||
{
|
{
|
||||||
// this element is deleted
|
// 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
|
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$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue