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 Return extends AbstractDigitalAction { 016 017 public Return(String sys, String user) { 018 super(sys, user); 019 } 020 021 @Override 022 public Base getDeepCopy(Map<String, String> systemNames, Map<String, String> userNames) throws JmriException { 023 DigitalActionManager manager = InstanceManager.getDefault(DigitalActionManager.class); 024 String sysName = systemNames.get(getSystemName()); 025 String userName = userNames.get(getSystemName()); 026 if (sysName == null) sysName = manager.getAutoSystemName(); 027 Return copy = new Return(sysName, userName); 028 copy.setComment(getComment()); 029 return manager.registerAction(copy); 030 } 031 032 /** {@inheritDoc} */ 033 @Override 034 public Category getCategory() { 035 return Category.FLOW_CONTROL; 036 } 037 038 /** {@inheritDoc} */ 039 @Override 040 public void execute() throws JmriException { 041 throw new ReturnException(); 042 } 043 044 @Override 045 public String getShortDescription(Locale locale) { 046 return Bundle.getMessage(locale, "Return_Short"); 047 } 048 049 @Override 050 public String getLongDescription(Locale locale) { 051 return getShortDescription(locale); 052 } 053 054 /** {@inheritDoc} */ 055 @Override 056 public void setup() { 057 // Do nothing 058 } 059 060// private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(WebBrowser.class); 061 062}