1 package org.simantics.document.swt.core.base;
5 import org.simantics.document.server.handler.AbstractEventHandler;
6 import org.simantics.document.server.io.CommandContext;
7 import org.simantics.document.server.io.CommandContextImpl;
8 import org.simantics.document.swt.core.SWTDocument;
10 public class PostEventCommand extends AbstractEventCommand {
12 private AbstractEventHandler handler;
13 private CommandContextImpl parameters;
15 public PostEventCommand(SWTDocument document, AbstractEventHandler handler, Map<String, String> parameters) {
16 this(document, handler, parameters, null);
19 public PostEventCommand(SWTDocument document, AbstractEventHandler handler, Map<String, String> parameters, PostEventCommand next) {
21 this.handler = handler;
22 this.parameters = new CommandContextImpl();
23 for(Map.Entry<String, String> entry : parameters.entrySet()) {
24 this.parameters.putString(entry.getKey(), entry.getValue());
30 public void handleCommand() {
31 document.post(handler, parameters);
35 public void commandSuccess() {
41 public void commandError(String errorMessage) {
42 System.err.println(this + " failed: " + errorMessage);