Class RunJythonScript

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

    public class RunJythonScript
    extends JmriAbstractAction
    This Action runs a script using an available script engine.

    The script engine to use is determined by the script's extension.

    There are two constructors. One, without a script file name, will open a FileDialog to prompt for the file to use. The other, with a File object, will directly invoke that file.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.io.File configuredFile  
      (package private) static javax.swing.JFileChooser fci
      We always use the same file chooser in this class, so that the user's last-accessed directory remains available.
      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      RunJythonScript​(java.lang.String name)
      Constructor that, when action is invoked, opens a JFileChooser to select file to invoke.
      RunJythonScript​(java.lang.String name, java.io.File file)
      Constructor that, when action is invoked, directly invokes the provided File.
      RunJythonScript​(java.lang.String s, javax.swing.Icon i, WindowInterface wi)  
      RunJythonScript​(java.lang.String s, WindowInterface wi)  
    • Field Detail

      • fci

        static javax.swing.JFileChooser fci
        We always use the same file chooser in this class, so that the user's last-accessed directory remains available.
    • Constructor Detail

      • RunJythonScript

        public RunJythonScript​(java.lang.String name)
        Constructor that, when action is invoked, opens a JFileChooser to select file to invoke.
        Parameters:
        name - Action name
      • RunJythonScript

        public RunJythonScript​(java.lang.String name,
                               java.io.File file)
        Constructor that, when action is invoked, directly invokes the provided File.
        Parameters:
        name - Action name
        file - the script file to invoke