use of ini.trakem2.tree.Thing in project TrakEM2 by trakem2.
the class TemplateThing method remove.
public boolean remove(boolean check) {
if (check) {
if (!Utils.check("Really delete " + this.toString() + (null == al_children || 0 == al_children.size() ? "" : " and all its children?")))
return false;
}
// remove the children, recursively
if (null != al_children) {
Object[] children = new Object[al_children.size()];
// can't delete directly from the al_children because the child will call removeChild on its parent
al_children.toArray(children);
for (int i = 0; i < children.length; i++) {
Object ob = children[i];
if (ob instanceof DBObject) {
if (!((DBObject) ob).remove(false)) {
Utils.showMessage("Deletion incomplete, check database, for child: " + ob.toString());
return false;
}
}
}
}
// remove the Thing itself
if (null != parent && !parent.removeChild(this)) {
Utils.showMessage("Deletion incomplete, check database, for parent of TemplateThing id=" + id);
return false;
}
return removeFromDatabase();
}
Aggregations