Revision: 3853
Author: mo.jeff
Date: Mon Aug 9 09:43:24 2010
Log: Attach SPObjectSnapshotUpdateListeners to the snapshots when loading
projects from the server, so that they can get updates to changes.
http://code.google.com/p/power-architect/source/detail?r=3853
Modified:
/trunk/src/main/java/ca/sqlpower/architect/SPObjectSnapshotHierarchyListener.java
=======================================
---
/trunk/src/main/java/ca/sqlpower/architect/SPObjectSnapshotHierarchyListener.java
Mon Aug 9 08:37:40 2010
+++
/trunk/src/main/java/ca/sqlpower/architect/SPObjectSnapshotHierarchyListener.java
Mon Aug 9 09:43:24 2010
@@ -103,6 +103,19 @@
} else if (e.getChild() instanceof SQLColumn) {
SQLColumn sqlColumn = (SQLColumn) e.getChild();
sqlColumn.getUserDefinedSQLType().addSPListener(this);
+ UserDefinedSQLType upstreamType =
sqlColumn.getUserDefinedSQLType().getUpstreamType();
+ if (upstreamType != null) {
+ List<UserDefinedSQLTypeSnapshot> udtSnapshots =
+
session.getWorkspace().getSnapshotCollection().getChildren(UserDefinedSQLTypeSnapshot.class);
+ for (UserDefinedSQLTypeSnapshot snapshot:
udtSnapshots) {
+ if
(upstreamType.equals(snapshot.getSPObject())) {
+ if (listenerMap.get(snapshot) == null) {
+ addUpdateListener(upstreamType);
+ }
+ break;
+ }
+ }
+ }
}
}