From 6f8a2f0b26aeda447ac55ea873a953404c3027a7 Mon Sep 17 00:00:00 2001 From: Antti Villberg Date: Fri, 23 Aug 2019 13:52:32 +0300 Subject: [PATCH] Improvements to modelled SWT documents (fixed) gitlab #357 Change-Id: Id366f13e6be8b598158e67af5d5a4aeb7644abb3 --- .../simantics/document/swt/core/base/PostEventCommand.java | 6 +++++- .../simantics/document/swt/core/widget/ButtonWidget.java | 2 ++ .../document/swt/core/widget/CommandEventWidget.java | 1 + .../graph/Components.pgraph | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/PostEventCommand.java b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/PostEventCommand.java index 7214bdd1f..24b6e6111 100644 --- a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/PostEventCommand.java +++ b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/PostEventCommand.java @@ -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; } diff --git a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/ButtonWidget.java b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/ButtonWidget.java index 72c7c360b..88afe7b2a 100644 --- a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/ButtonWidget.java +++ b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/ButtonWidget.java @@ -75,6 +75,7 @@ public class ButtonWidget extends LeafWidgetManager