X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.document.swt.core%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fswt%2Fcore%2Fwidget%2FCommandEventWidget.java;h=6eb69541860798def6fd472443cc8595a9cbece6;hb=refs%2Fheads%2Fprivate%2Fantin_tyomaa;hp=23311d93c18a00757af97dfea980ea379c513fcc;hpb=342a2b006b88330280060c16c2ab50374468a4c6;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/CommandEventWidget.java b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/CommandEventWidget.java index 23311d93c..6eb695418 100644 --- a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/CommandEventWidget.java +++ b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/CommandEventWidget.java @@ -1,6 +1,5 @@ package org.simantics.document.swt.core.widget; -import java.util.HashMap; import java.util.List; import java.util.TreeMap; @@ -10,6 +9,10 @@ import org.simantics.document.server.bean.DataDefinition; import org.simantics.document.server.client.WidgetData; import org.simantics.document.server.client.WidgetManager; import org.simantics.document.server.handler.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.server.io.ICommand; import org.simantics.document.swt.core.SWTDocument; import org.simantics.document.swt.core.base.PostEventCommand; import org.simantics.document.swt.core.base.PropertyWidgetManager; @@ -33,10 +36,11 @@ public class CommandEventWidget extends PropertyWidgetManager { } @Override - public IEventCommand eventCommand(SWTDocument document, JSONObject object, Object component, String command) { - if("event".equals(command)) { + public IEventCommand eventCommand(SWTDocument document, JSONObject object, Object component, ICommand command, CommandContext p) { + if("event".equals(command.getCommand())) { List dataDefinitions = object.getJSONField("dataDefinitions"); - HashMap data = new HashMap(); + CommandContextMutable context = new CommandContextImpl(); + context.merge(p); for(DataDefinition dd : dataDefinitions) { WidgetData wd = document.getWidgetData().get(dd.getElementId()); if(wd != null && wd.object != null) { @@ -45,12 +49,12 @@ public class CommandEventWidget extends PropertyWidgetManager { if(manager != null) { @SuppressWarnings("unchecked") String result = manager.getProperty(document, wd.object, wd.widget, dd.getProperty()); - data.put(dd.getTarget(), result); + context.putValue(dd.getTarget(), result); } } } AbstractEventHandler handler = object.getJSONField("SCLFunction"); - return new PostEventCommand(document, handler, data); + return new PostEventCommand(document, handler, context); } else { return null; }