X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.document.swt.core%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fswt%2Fcore%2Fbase%2FAbstractEventCommand.java;h=57a2fbbe8312e0e3bb397b194d7f2248172e10b6;hp=fb11a8aea14d0feeb859a1a0e7dbdd5a11b259f8;hb=e4ffdffae875e518a4eb070b8bda6ead1a9843d3;hpb=969bd23cab98a79ca9101af33334000879fb60c5 diff --git a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/AbstractEventCommand.java b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/AbstractEventCommand.java index fb11a8aea..57a2fbbe8 100644 --- a/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/AbstractEventCommand.java +++ b/bundles/org.simantics.document.swt.core/src/org/simantics/document/swt/core/base/AbstractEventCommand.java @@ -1,36 +1,39 @@ -package org.simantics.document.swt.core.base; - -import org.simantics.document.server.IEventCommand; -import org.simantics.document.swt.core.SWTDocument; - -public abstract class AbstractEventCommand implements IEventCommand { - - protected IEventCommand next; - protected SWTDocument document; - - public AbstractEventCommand(SWTDocument document) { - this.document = document; - } - - @Override - public void setNext(IEventCommand next) { - this.next = next; - } - - @Override - public IEventCommand getNext() { - return this.next; - } - - @Override - public void commandSuccess() { - if(next != null) - next.handleCommand(); - } - - @Override - public void commandError(String errorMessage) { - System.err.println(this + " failed: " + errorMessage); - } - -} +package org.simantics.document.swt.core.base; + +import org.simantics.document.server.IEventCommand; +import org.simantics.document.server.io.CommandContext; +import org.simantics.document.server.io.CommandContextMutable; +import org.simantics.document.swt.core.SWTDocument; + +public abstract class AbstractEventCommand implements IEventCommand { + + protected IEventCommand next; + protected SWTDocument document; + + public AbstractEventCommand(SWTDocument document) { + this.document = document; + } + + @Override + public void setNext(IEventCommand next) { + this.next = next; + } + + @Override + public IEventCommand getNext() { + return this.next; + } + + @Override + public CommandContext commandSuccess(CommandContextMutable context) { + if(next != null) + return next.handleCommand(context); + return context; + } + + @Override + public void commandError(String errorMessage) { + System.err.println(this + " failed: " + errorMessage); + } + +}