package jp.hasc.hasctool.ui.commands;

import jp.hasc.hasctool.ui.util.UIUtil;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.handlers.HandlerUtil;

/**
 * @author iwasaki
 */
public class StopBlockDiagramCommand extends AbstractHandler {
	/** logger for this class */
	private final static org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
			.getLog(StopBlockDiagramCommand.class);
	
	public static final String ID_COMMAND="jp.hasc.hasctool.ui.commands.StopBlockDiagramCommand";

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		try{
			BlockDiagramExecutorManager m=BlockDiagramExecutorManager.getInstance(event);
			m.stopExecution();
		} catch (Exception ex) {
			LOG.warn("Exception", ex);
			UIUtil.showMessageDialog(HandlerUtil.getActiveShell(event), "[Exception]\n" + ex.toString());
		}
		return null;
	}


}
