]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/PostEventCommand.java
Improvements to modelled SWT documents (fixed)
[simantics/platform.git] / bundles / org.simantics.document.swt.core / src / org / simantics / document / swt / core / base / PostEventCommand.java
index 7214bdd1f1691057c25a304621b4112339c9ada9..24b6e6111c41774337c9aec5934decaf7c3da8d7 100644 (file)
@@ -13,6 +13,7 @@ package org.simantics.document.swt.core.base;
 
 import org.simantics.document.server.io.AbstractEventHandler;
 import org.simantics.document.server.io.CommandContext;
+import org.simantics.document.server.io.CommandContextImpl;
 import org.simantics.document.server.io.CommandContextMutable;
 import org.simantics.document.swt.core.SWTDocument;
 
@@ -27,6 +28,7 @@ public class PostEventCommand extends AbstractEventCommand {
     
     public PostEventCommand(SWTDocument document, AbstractEventHandler handler, CommandContextMutable context, PostEventCommand next) {
         super(document);
+        assert(handler != null);
         this.handler = handler;
         this.context = context;
         this.next = next;
@@ -34,7 +36,9 @@ public class PostEventCommand extends AbstractEventCommand {
 
     @Override
     public CommandContext handleCommand(CommandContextMutable context) {
-        document.post(handler, context);
+        CommandContextMutable mergedContext = new CommandContextImpl().merge(context)
+                .merge(this.context);
+        document.post(handler, mergedContext);
         return context;
     }