| /******************************************************************************* |
| * Copyright (c) 2008-2010, Istvan Rath and Daniel Varro |
| * 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: |
| * Istvan Rath - initial API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.viatra2.frameworkgui.views.console.commands.xform; |
| |
| import java.util.List; |
| |
| import org.eclipse.viatra2.framework.IFramework; |
| import org.eclipse.viatra2.frameworkgui.views.console.commands.IVIATRAConsoleCommandProvider; |
| |
| /** |
| * VIATRA2 console command to facilitate the undo transaction operation. |
| * @author istvan rath |
| * |
| */ |
| public class UndoTransaction implements IVIATRAConsoleCommandProvider { |
| |
| |
| public void executeCommand(IFramework fw, List<String> parameters) { |
| // 0. check if we have exactly two parameters |
| if (parameters.size()!=1) { |
| fw.getLogger().error("[UndoTransaction] Wrong number of parameters supplied. Expected: 1, received: "+parameters.size()); |
| return; |
| } |
| String transID = parameters.get(0); |
| fw.getTopmodel().getTransactionManager().undoTransaction(transID); |
| } |
| |
| public String getCommandSignature() { |
| return "undotransaction(transactionID)"; |
| } |
| |
| public String getDescription() { |
| return "Rolls back the VIATRA2 modelspace to the state before the transaction with the given ID was executed."; |
| } |
| |
| public String getHelpText() { |
| return "Use undotransaction(<<transactionID>>) to undo the effects of a previously executed undoable transaction.\nThis command "+getDescription(); |
| } |
| |
| } |