Revision: 4013
Author: [email protected]
Date: Wed Dec  1 12:50:47 2010
Log: Another fix for the types feature. Magic was not being checked correctly when updating the use count of the snapshot types. If magic is disabled (ie we are loading or undoing) then the events will include the updates to the snapshots. If we try and correct the snapshots at the same time we over correct and get into an incorrect state.
http://code.google.com/p/power-architect/source/detail?r=4013

Modified:
/trunk/src/main/java/ca/sqlpower/architect/enterprise/SPObjectSnapshotHierarchyListener.java

=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/enterprise/SPObjectSnapshotHierarchyListener.java Wed Sep 15 08:25:34 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/enterprise/SPObjectSnapshotHierarchyListener.java Wed Dec 1 12:50:47 2010
@@ -119,7 +119,7 @@
         } else if (e.getChild() instanceof SQLColumn) {
             SQLColumn sqlColumn = (SQLColumn) e.getChild();
UserDefinedSQLType upstreamType = sqlColumn.getUserDefinedSQLType().getUpstreamType();
-            if (upstreamType != null) {
+            if (sqlColumn.isMagicEnabled() && upstreamType != null) {

// check if the upstream type is exactly an existing snapshot
                 List<UserDefinedSQLTypeSnapshot> udtSnapshots =
@@ -524,6 +524,7 @@
      *         new snapshot type. Return false if otherwise.
      */
     private void reassignType(SQLColumn column) {
+        if (!column.isMagicEnabled()) return;
UserDefinedSQLType upstreamType = column.getUserDefinedSQLType().getUpstreamType();
         SPObject upstreamTypeParent = upstreamType.getParent();

Reply via email to