1 package org.simantics.document.swt.core.base;
3 import org.simantics.document.server.io.AbstractEventHandler;
4 import org.simantics.document.server.io.CommandContext;
5 import org.simantics.document.server.io.CommandContextMutable;
6 import org.simantics.document.swt.core.SWTDocument;
8 public class PostEventCommand extends AbstractEventCommand {
10 private AbstractEventHandler handler;
11 private CommandContextMutable context;
13 public PostEventCommand(SWTDocument document, AbstractEventHandler handler, CommandContextMutable context) {
14 this(document, handler, context, null);
17 public PostEventCommand(SWTDocument document, AbstractEventHandler handler, CommandContextMutable context, PostEventCommand next) {
19 this.handler = handler;
20 this.context = context;
25 public CommandContext handleCommand(CommandContextMutable context) {
26 document.post(handler, context);
31 public CommandContext commandSuccess(CommandContextMutable context) {
33 return next.handleCommand(context);
38 public void commandError(String errorMessage) {
39 System.err.println(this + " failed: " + errorMessage);