blob: 7008300e0188fbfae7aba423ec1b1efa2bcb6e78 [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation
*
*/
package org.eclipse.osbp.runtime.emf.edit.commands;
import org.eclipse.emf.common.command.AbstractCommand;
/**
* Uses the {@link SimpleCommand} to record notifications.
*/
public abstract class SimpleCommand extends AbstractCommand {
public SimpleCommand(String name) {
super(name);
}
@Override
public void execute() {
doExecute();
}
@Override
public void redo() {
doRedo();
}
@Override
protected boolean prepare() {
return true;
}
@Override
public void undo() {
doUndo();
}
@Override
public boolean canUndo() {
return true;
}
protected abstract void doExecute();
/**
* Override if required.
*/
protected void doRedo() {
doExecute();
}
protected abstract void doUndo();
}