]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/widget/ButtonWidget.java
Improvements to modelled SWT documents (fixed)
[simantics/platform.git] / bundles / org.simantics.document.swt.core / src / org / simantics / document / swt / core / widget / ButtonWidget.java
index 72c7c360b0566529d0941f58557ed9cd93d4c4eb..88afe7b2ab802bcc235952bdaa6d42766f2cf68a 100644 (file)
@@ -75,6 +75,7 @@ public class ButtonWidget extends LeafWidgetManager<Button> {
             List<ICommand> commands = object.getJSONField("commands");
             HashSet<Object> listeners = new HashSet<Object>();
             List<Pair<WidgetData, ICommand>> data = new ArrayList<>();
+            data.addAll(SWTViews.getTriggeredCommands(document, commands, "click"));
             data.addAll(SWTViews.getTriggeredCommands(document, commands, "eventOut"));
             data.add(new Pair<WidgetData, ICommand>(wd, new Command("onPress")));
             SelectionListener listener = new ButtonSelectionListener(wd, data);
@@ -102,6 +103,7 @@ public class ButtonWidget extends LeafWidgetManager<Button> {
         if("onPress".equals(command.getCommand())) {
             CommandContextMutable context = new CommandContextImpl().merge(p);
             AbstractEventHandler onPress = object.getJSONField("onPress");
+            if(onPress == null) return null;
             return new PostEventCommand(document, onPress, context);
         }
         return null;