Revision: 3804
Author: mo.jeff
Date: Thu Jul 29 08:30:29 2010
Log: Added the SPObjectSnapshotUpdateListener as a means for the type
snapshots listening to changes to the original system type, and being able
to mark themselves as obsolete if changes did happen.
TODOS:
* Reattach the listeners when loading up a project again. Currently, the
listeners only attach themselves when snapshots get initially created
* UI notification of obsolete snapshots
* Allow snapshots to be updateable.
http://code.google.com/p/power-architect/source/detail?r=3804
Modified:
/trunk/src/main/java/ca/sqlpower/architect/swingui/ColumnEditPanel.java
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/swingui/ColumnEditPanel.java
Thu Jul 29 08:06:39 2010
+++ /trunk/src/main/java/ca/sqlpower/architect/swingui/ColumnEditPanel.java
Thu Jul 29 08:30:29 2010
@@ -77,6 +77,7 @@
import ca.sqlpower.object.ObjectDependentException;
import ca.sqlpower.object.SPChildEvent;
import ca.sqlpower.object.SPListener;
+import ca.sqlpower.sqlobject.SPObjectSnapshotUpdateListener;
import ca.sqlpower.sqlobject.SQLColumn;
import ca.sqlpower.sqlobject.SQLObject;
import ca.sqlpower.sqlobject.SQLObjectException;
@@ -1005,7 +1006,9 @@
} else {
snapshot = new
UserDefinedSQLTypeSnapshot(upstreamType, systemRevision, isDomainSnapshot);
}
- session.getWorkspace().addChild(snapshot, 0);
+ SPObjectSnapshotUpdateListener updateListener =
new SPObjectSnapshotUpdateListener(snapshot);
+ upstreamType.addSPListener(updateListener);
+ session.getWorkspace().addChild(snapshot, 0);
column.getUserDefinedSQLType().setUpstreamType(snapshot.getSPObject());
if ((upstreamType.getParent() instanceof
DomainCategory)) {
DomainCategory parent = (DomainCategory)
upstreamType.getParent();