Revision: 3213
Author: [email protected]
Date: Wed Dec 16 14:38:24 2009
Log: Disconnecting some objects from their parents will disconnect their
children. One example of this is SQLRelationship will be disconnected from
its parent table when the table is removed. For these cases the delete
action should not try to disconnect the parent-child relationship again or
it will receive an exception.
http://code.google.com/p/power-architect/source/detail?r=3213
Modified:
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
=======================================
---
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
Tue Dec 1 14:35:17 2009
+++
/branches/sqlobject-spobject-model/src/ca/sqlpower/architect/swingui/action/DeleteSelectedAction.java
Wed Dec 16 14:38:24 2009
@@ -147,7 +147,12 @@
}
}
} else {
- o.getParent().removeChild(o);
+ //Side effect of removing a relationship's parent
table is to remove the relationship
+ //causing this to fail if the relationship is
removed immediately after.
+ if (o.getParent() != null &&
+
o.getParent().getChildrenWithoutPopulating().contains(o)) {
+ o.getParent().removeChild(o);
+ }
}
} catch (LockedColumnException ex) {
int decision = JOptionPane.showConfirmDialog(playpen,