001package jmri.jmrit.operations.automation.actions;
002
003import jmri.jmrit.operations.automation.AutomationItem;
004
005public class GotoSuccessAction extends GotoAction {
006
007    private static final int _code = ActionCodes.GOTO_IF_TRUE;
008
009    @Override
010    public int getCode() {
011        return _code;
012    }
013
014    @Override
015    public String getName() {
016        return Bundle.getMessage("GotoIfSuccess");
017    }
018
019    @Override
020    public void doAction() {
021        if (getAutomationItem() != null) {
022            AutomationItem gotoAutomationItem = getAutomationItem().getGotoAutomationItem();
023            if (gotoAutomationItem != null) {
024                setRunning(true);
025                // the old property controls conditional branch if successful
026                firePropertyChange(ACTION_GOTO_CHANGED_PROPERTY, true, gotoAutomationItem);
027            }
028            finishAction(gotoAutomationItem != null);
029        }
030    }
031}