/******************************************************************************* | |
* Copyright (c) 2012-2013 EclipseSource Muenchen GmbH and others. | |
* | |
* 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: | |
* Edgar | |
******************************************************************************/ | |
package org.eclipse.emf.emfstore.internal.client.ui.controller; | |
import org.eclipse.core.runtime.IProgressMonitor; | |
import org.eclipse.emf.emfstore.client.ESLocalProject; | |
import org.eclipse.emf.emfstore.client.util.ESVoidCallable; | |
import org.eclipse.emf.emfstore.client.util.RunESCommand; | |
import org.eclipse.emf.emfstore.internal.client.model.ProjectSpace; | |
import org.eclipse.emf.emfstore.internal.client.model.impl.api.ESLocalProjectImpl; | |
import org.eclipse.emf.emfstore.server.exceptions.ESException; | |
import org.eclipse.swt.widgets.Shell; | |
/** | |
* | |
* @author Edgar | |
* | |
*/ | |
public class UIUndoLastOperationController extends | |
AbstractEMFStoreUIController<Void> { | |
private final ProjectSpace projectSpace; | |
/** | |
* Constructor. | |
* | |
* @param shell | |
* the shell that will be used during the reversal of the | |
* operation | |
* @param localProject | |
* the {@link ESLocalProject} upon which to reverse the last | |
* operation | |
*/ | |
public UIUndoLastOperationController(Shell shell, | |
ESLocalProject localProject) { | |
super(shell); | |
projectSpace = ((ESLocalProjectImpl) localProject) | |
.toInternalAPI(); | |
} | |
/** | |
* | |
* {@inheritDoc} | |
* | |
* @see org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction#doRun(org.eclipse.core.runtime.IProgressMonitor) | |
*/ | |
@Override | |
public Void doRun(IProgressMonitor progressMonitor) throws ESException { | |
RunESCommand.run(new ESVoidCallable() { | |
@Override | |
public void run() { | |
projectSpace.getOperationManager().undoLastOperation(); | |
} | |
}); | |
return null; | |
} | |
} |