001package jmri.jmrit.operations.automation.actions;
002
003import jmri.jmrit.operations.automation.AutomationItem;
004
005public class GotoFailureAction extends GotoAction {
006
007    private static final int _code = ActionCodes.GOTO_IF_FALSE;
008
009    @Override
010    public int getCode() {
011        return _code;
012    }
013
014    @Override
015    public String getName() {
016        return Bundle.getMessage("GotoIfFailure");
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 failure
026                firePropertyChange(ACTION_GOTO_CHANGED_PROPERTY, false, gotoAutomationItem);
027            }
028            finishAction(gotoAutomationItem != null);
029        }
030    }
031}