001package jmri.jmrit.logixng.actions; 002 003import java.util.Locale; 004import java.util.Map; 005 006import jmri.InstanceManager; 007import jmri.JmriException; 008import jmri.jmrit.logixng.*; 009 010/** 011 * Returns from a Module or a ConditionalNG. 012 * 013 * @author Daniel Bergqvist Copyright 2022 014 */ 015public class Exit 016 extends AbstractDigitalAction { 017 018 public Exit(String sys, String user) { 019 super(sys, user); 020 } 021 022 @Override 023 public Base getDeepCopy(Map<String, String> systemNames, Map<String, String> userNames) throws JmriException { 024 DigitalActionManager manager = InstanceManager.getDefault(DigitalActionManager.class); 025 String sysName = systemNames.get(getSystemName()); 026 String userName = userNames.get(getSystemName()); 027 if (sysName == null) sysName = manager.getAutoSystemName(); 028 Exit copy = new Exit(sysName, userName); 029 copy.setComment(getComment()); 030 return manager.registerAction(copy); 031 } 032 033 /** {@inheritDoc} */ 034 @Override 035 public Category getCategory() { 036 return Category.FLOW_CONTROL; 037 } 038 039 /** {@inheritDoc} */ 040 @Override 041 public void execute() throws JmriException { 042 throw new ExitException(); 043 } 044 045 @Override 046 public String getShortDescription(Locale locale) { 047 return Bundle.getMessage(locale, "Exit_Short"); 048 } 049 050 @Override 051 public String getLongDescription(Locale locale) { 052 return getShortDescription(locale); 053 } 054 055 /** {@inheritDoc} */ 056 @Override 057 public void setup() { 058 // Do nothing 059 } 060 061// private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(WebBrowser.class); 062 063}