]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterChange.java
Better emptying of trash bin
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / ClusterChange.java
index 1a264dc515d5329d22ec1f285f1043cf08771d1a..fa0b0797f2a2e0e1c4fb34d8af4cbea3bf4c9ea4 100644 (file)
@@ -54,7 +54,12 @@ public final class ClusterChange {
     public ClusterImpl clusterImpl;
 
     public ClusterChange(ClusterStream clusterStream, ClusterImpl clusterImpl) {
+       
         this.clusterImpl = clusterImpl;
+
+        if (!clusterImpl.isLoaded())
+            new IllegalStateException("Change to proxy cluster " + clusterImpl.getClusterUID()).printStackTrace();
+
         clusterUID = clusterImpl.getClusterUID();
         long[] longs = new long[ClusterUID.getLongLength()];
         clusterUID.toLong(longs, 0);
@@ -69,9 +74,13 @@ public final class ClusterChange {
             Bytes.writeLE(header, offset, longs[i]);
         //initBuffer();
         this.clusterStream = clusterStream;
-        this.clusterChange2 = new ClusterChange2(clusterUID, clusterImpl);
+        this.clusterChange2 = new ClusterChange2(clusterUID);
         clusterStream.changes.add(this);
     }
+    
+    public void adopt(ClusterImpl impl) {
+        this.clusterImpl = impl;
+    }
 
     private void setHeaderVectorSize(int size) {
         if (size < 0)
@@ -81,7 +90,7 @@ public final class ClusterChange {
     }
     @Override
     public String toString() {
-        return super.toString() + " cluster=" + clusterImpl.getClusterUID() + " id=" + clusterImpl.getClusterId() + " off=" + byteIndex;
+        return super.toString() + " cluster=" + clusterUID + " id=" + clusterImpl.getClusterId() + " off=" + byteIndex;
     }
     private final void initBuffer() {
         flushed = false;