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:
parent
2020cc540c
commit
918b9b28c1
1 changed files with 26 additions and 18 deletions
|
@ -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$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue