blob: 9f0b8a690e19815642152c35114e9eb587cf41ed [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011-2012 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:
* Eugen Neufeld - initial API and implementation
*
*******************************************************************************/
package org.eclipse.emf.ecp.workspace.internal.ui;
import org.eclipse.emf.ecp.spi.core.InternalProject;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
/**
* Undo Last Command Handler.
*
* @author Tobias Verhoeven
*
*/
public class UndoLastCommandHandler extends AbstractHandler {
/** {@inheritDoc} **/
public Object execute(ExecutionEvent event) throws ExecutionException {
InternalProject project = (InternalProject) ((IStructuredSelection) HandlerUtil.getActiveMenuSelection(event))
.getFirstElement();
if (project == null) {
return null;
}
project.getEditingDomain().getCommandStack().undo();
return null;
}
}