All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jsoar.debugger.actions.StepAction Maven / Gradle / Ivy

/*
 * Copyright (c) 2008  Dave Ray 
 *
 * Created on Oct 25, 2008
 */
package org.jsoar.debugger.actions;

import java.awt.event.ActionEvent;

import javax.swing.KeyStroke;

import org.jsoar.debugger.RunControlModel;
import org.jsoar.kernel.RunType;

/**
 * @author ray
 */
public class StepAction extends AbstractDebuggerAction
{
    private static final long serialVersionUID = -1460902354871319429L;

    private final RunType runType;
    
    /**
     * @param manager the owning action manager
     */
    public StepAction(ActionManager manager, String text, RunType runType, String keyStroke)
    {
        super(manager, text);
        setAcceleratorKey(KeyStroke.getKeyStroke(keyStroke));
        this.runType = runType;
    }

    /* (non-Javadoc)
     * @see org.jsoar.debugger.actions.AbstractDebuggerAction#update()
     */
    @Override
    public void update()
    {
        setEnabled(!getApplication().getAgent().isRunning());
    }

    /* (non-Javadoc)
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
     */
    @Override
    public void actionPerformed(ActionEvent arg0)
    {
        final RunControlModel model = getApplication().getRunControlModel();
        model.setType(runType);
        getApplication().getAgent().runFor(1, model.getType());
        getApplication().updateActionsAndStatus();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy