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:
parent
48ef3db9b8
commit
a479f02926
1 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue