blob: f3a1ea8dd89af3cd0b1586465094921c28b7faf2 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Andras Okros, 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:
* Andras Okros - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.gtasm.trigger.view;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.viatra2.frameworkgui.actions.AbstractFrameworkGUIAction;
import org.eclipse.viatra2.frameworkgui.views.FrameworkTreeView;
import org.eclipse.viatra2.gtasm.trigger.engine.TriggerEngineManager;
import org.eclipse.viatra2.gtasm.trigger.view.FrameworkViewExtension.TriggerDummy;
/**
* An action for deleting triggers from the execution engine.
* @author Andr�s �kr�s
*/
public class DeleteTriggerAction extends AbstractFrameworkGUIAction {
public DeleteTriggerAction(FrameworkTreeView part) {
super();
setupInternals(part);
setText("Drop");
setToolTipText("Drops the trigger from the trigger execution engine");
setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public void run() {
refreshSelection();
Object o = getFirstSelected();
if (o instanceof TriggerDummy)
{
TriggerEngineManager.getInstance().getTriggerEngine(iViatraFramework).deleteTrigger(((TriggerDummy)o).getTrigger());
}
}
}