/*******************************************************************************
* Copyright (c) 2008, 2011 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.emf.eef.runtime.impl.command;
import org.eclipse.emf.common.command.AbstractCommand;
import org.eclipse.emf.ecore.change.ChangeDescription;
import org.eclipse.emf.eef.runtime.context.PropertiesEditingContext;
/**
* @author <a href="mailto:goulwen.lefur@obeo.fr">Goulwen Le Fur</a>
*/
public abstract class StandardEditingCommand extends AbstractCommand {
protected PropertiesEditingContext context;
public StandardEditingCommand(PropertiesEditingContext context) {
super();
this.context = context;
}
public StandardEditingCommand(String label, String description) {
super(label, description);
}
public StandardEditingCommand(String label) {
super(label);
}
protected ChangeDescription description;
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.common.command.AbstractCommand#prepare()
*/
@Override
protected boolean prepare() {
return true;
}
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.common.command.Command#redo()
*/
public void redo() {
description.applyAndReverse();
}
public void undo() {
description.applyAndReverse();
}
}