blob: f2551999e9e8f6477a8ab8219b43fe5d059bfe12 [file] [log] [blame]
/*****************************************************************************
* 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 v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.diagram.common.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();
}
}