001package jmri.jmrit.operations.automation.actions; 002 003public class HaltAction extends Action { 004 005 private static final int _code = ActionCodes.HALT_ACTION; 006 007 @Override 008 public int getCode() { 009 return _code; 010 } 011 012 @Override 013 public String getName() { 014 return Bundle.getMessage("Halt"); 015 } 016 017 @Override 018 public void doAction() { 019 if (getAutomationItem() != null) { 020 // can't use "finishAction(boolean)" must halt 021 setRunning(true); 022 getAutomationItem().setActionSuccessful(true); 023 setRunning(false); 024 sendMessage(getAutomationItem().getMessage(), new Object[]{Bundle.getMessage("HALT")}, true); 025 firePropertyChange(ACTION_HALT_CHANGED_PROPERTY, false, true); 026 } 027 } 028 029 @Override 030 public void cancelAction() { 031 // no cancel for this action 032 } 033 034 @Override 035 public String getActionSuccessfulString() { 036 return Bundle.getMessage("HALT"); 037 } 038}