/***************************************************************************** * Copyright (c) 2010 Atos Origin. * * * 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: * Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation * *****************************************************************************/ package org.eclipse.papyrus.commands.wrappers; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; /** * This command proxy wraps a GEF command into a GMF one, * with result stored in the CommandResult. * * @author mvelten * */ public class CommandProxyWithResult extends CommandProxy { public CommandProxyWithResult(Command command, Object result) { super(command); setResult(CommandResult.newOKCommandResult(result)); } @Override protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { super.doExecuteWithResult(progressMonitor, info); return getCommandResult(); } @Override protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { super.doRedoWithResult(progressMonitor, info); return getCommandResult(); } @Override protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { super.doUndoWithResult(progressMonitor, info); return getCommandResult(); } }