]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server.io/src/org/simantics/document/server/io/CommandContextImpl.java
Fixed CommandContextImpl.merge to not duplicate same values in result
[simantics/platform.git] / bundles / org.simantics.document.server.io / src / org / simantics / document / server / io / CommandContextImpl.java
index 5b49810fad9f8109c5a4a637ab24444ea3bf059c..5fb3a283e93a0b635768e5517fc1b3e6f14ac50d 100644 (file)
@@ -66,6 +66,12 @@ public class CommandContextImpl implements CommandContextMutable {
                if (context != null) {
                        Map<String,List<List<Object>>> from = context.getData(); 
                        for (Map.Entry<String, List<List<Object>>> entry : from.entrySet()) {
+                               String key = entry.getKey();
+                               Object existing = getValue(key);
+                               Object newValue = context.getValue(key);
+                               // Do not merge duplicates!
+                               if (newValue != null && newValue.equals(existing))
+                                       continue;
                                List<List<Object>> rows = ensureRowsAvailable(entry.getKey());
                                rows.addAll(entry.getValue());
                        }