Package jmri.jmrit.jython
Class RunJythonScript
java.lang.Object
javax.swing.AbstractAction
jmri.util.swing.JmriAbstractAction
jmri.jmrit.jython.RunJythonScript
- All Implemented Interfaces:
ActionListener,Serializable,Cloneable,EventListener,Action
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:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) File(package private) static JFileChooserWe always use the same file chooser in this class, so that the user's last-accessed directory remains available.Fields inherited from class jmri.util.swing.JmriAbstractAction
context, hint, wiFields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields 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
ConstructorsConstructorDescriptionRunJythonScript(String name) Constructor that, when action is invoked, opens a JFileChooser to select file to invoke.RunJythonScript(String name, File file) Constructor that, when action is invoked, directly invokes the provided File.RunJythonScript(String s, Icon i, WindowInterface wi) RunJythonScript(String s, WindowInterface wi) -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoking this action via an event triggers display of a file dialog.(package private) void(package private) FileMethods inherited from class jmri.util.swing.JmriAbstractAction
dispose, setContext, setHint, setName, setParameter, setParameter, setWindowInterface, toStringMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
configuredFile
-
fci
We always use the same file chooser in this class, so that the user's last-accessed directory remains available.
-
-
Constructor Details
-
RunJythonScript
-
RunJythonScript
-
RunJythonScript
Constructor that, when action is invoked, opens a JFileChooser to select file to invoke.- Parameters:
name- Action name
-
RunJythonScript
Constructor that, when action is invoked, directly invokes the provided File.- Parameters:
name- Action namefile- the script file to invoke
-
-
Method Details
-
actionPerformed
Invoking this action via an event triggers display of a file dialog. If a file is selected, it's then invoked as a script.- Specified by:
actionPerformedin interfaceActionListener- Overrides:
actionPerformedin classJmriAbstractAction
-
selectFile
-
invoke
-
makePanel
- Specified by:
makePanelin classJmriAbstractAction
-