blob: 2bdd5ac6dfb419d9c3fa6842a5fb8b5863bde6a4 [file] [log] [blame]
/*******************************************************************************
* 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.frameworkgui.content.transformation;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.viatra2.frameworkgui.actions.AbstractFrameworkGUIAction;
import org.eclipse.viatra2.frameworkgui.content.transformation.TransformationContent.MachineDummy;
import org.eclipse.viatra2.frameworkgui.runner.TransformationRunner;
import org.eclipse.viatra2.frameworkgui.views.FrameworkTreeView;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.definitions.Machine;
public class RunModelAction extends AbstractFrameworkGUIAction
{
public RunModelAction(FrameworkTreeView part)
{
super();
setupInternals(part);
setText("Run...");
setToolTipText("Runs the selected entity as an ASM");
setImageDescriptor(PlatformUI.getWorkbench().getSharedImages()
.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public void run()
{
refreshSelection();
Object c = getFirstSelected();
if (c instanceof MachineDummy)
{
Machine m = ((MachineDummy)c).getMachine();
TransformationRunner.run(m, iViatraFramework, iFT.getViewSite().getShell());
}
}
}