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

dstore - problem with spirited elements - need to clean an element's children before clearing the elements data

This commit is contained in:
David McKnight 2007-11-30 19:00:55 +00:00
parent 48ef3db9b8
commit a479f02926

View file

@ -82,6 +82,8 @@ public abstract class UpdateHandler extends Handler
DataElement parent = child.getParent();
DataElementRemover.addToRemovedCount();
cleanChildren(child); // clean the children
if (child.isSpirit())
{
// officially delete this now
@ -106,6 +108,30 @@ public abstract class UpdateHandler extends Handler
_dataStore.getTempRoot().removeNestedData();
}
/**
* Recursively clean children for deletion
* @param parent
*/
protected void cleanChildren(DataElement parent)
{
List nestedData = parent.getNestedData();
if (nestedData != null)
{
for (int i = 0; i < nestedData.size(); i++){
DataElement child = (DataElement)nestedData.get(i);
cleanChildren(child);
if (child.isSpirit())
{
// officially delete this now
child.delete();
}
child.clear();
parent.removeNestedData(child);
}
}
}
/**
* Adds a set of data objects to the update queue