/******************************************************************************* | |
* Copyright (c) 2004-2008 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.treeeditor.actions; | |
import org.eclipse.ui.ISharedImages; | |
import org.eclipse.ui.PlatformUI; | |
import org.eclipse.ui.actions.ActionFactory; | |
import org.eclipse.viatra2.treeeditor.ViatraTreeEditor; | |
public class ViatraUndoAction extends ViatraRetargetAction { | |
public ViatraUndoAction() { | |
super(ActionFactory.UNDO.getId(), "Undo [ViatraEditor]"); | |
setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO)); | |
setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED)); | |
setHoverImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_HOVER)); | |
} | |
@Override | |
public void run() { | |
iVTE.getCommandStack().undo(); | |
//iVTE.setDirty(); | |
} | |
@Override | |
public void updateSelf(ViatraTreeEditor vte) { | |
super.updateSelf(vte); | |
setEnabled(iVTE.getCommandStack().isUndoable()); | |
} | |
} |