public final class ScriptRunner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_SCRIPT |
static javax.script.ScriptEngineManager |
MANAGER |
static java.lang.String |
SCRIPT_GUI_FUNCTION_NAME
Scripts that want to run on the Event Dispatch Thread should define a
top-level function with this name and NOT evaluate it.
|
static java.lang.String |
VAR_CONSOLE |
static java.lang.String |
VAR_CORE |
static java.lang.String |
VAR_EDITOR |
static java.lang.String |
VAR_GLOSSARY |
static java.lang.String |
VAR_MAINWINDOW |
static java.lang.String |
VAR_PROJECT |
static java.lang.String |
VAR_RESOURCES |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
executeScript(ScriptItem item,
java.util.Map<java.lang.String,java.lang.Object> additionalBindings)
Execute as read from the file associated with the supplied
ScriptItem . |
static java.lang.Object |
executeScript(java.lang.String script,
javax.script.ScriptEngine engine,
java.util.Map<java.lang.String,java.lang.Object> additionalBindings)
Execute a script with a given engine and bindings.
|
static java.lang.String |
executeScript(java.lang.String script,
ScriptItem item,
java.util.Map<java.lang.String,java.lang.Object> additionalBindings)
Execute a script either in string form or, if
script is
null, as read from the file associated with the supplied
ScriptItem . |
static java.util.List<java.lang.String> |
getAvailableScriptExtensions() |
public static final java.lang.String SCRIPT_GUI_FUNCTION_NAME
public static final java.lang.String DEFAULT_SCRIPT
public static final java.lang.String VAR_CONSOLE
public static final java.lang.String VAR_MAINWINDOW
public static final java.lang.String VAR_GLOSSARY
public static final java.lang.String VAR_CORE
public static final java.lang.String VAR_EDITOR
public static final java.lang.String VAR_PROJECT
public static final java.lang.String VAR_RESOURCES
public static final javax.script.ScriptEngineManager MANAGER
public static java.lang.String executeScript(ScriptItem item, java.util.Map<java.lang.String,java.lang.Object> additionalBindings) throws java.io.IOException, javax.script.ScriptException
ScriptItem
. This is a convenience method for
executeScript(String, ScriptItem, Map)
.item
- additionalBindings
- javax.script.ScriptException
java.io.IOException
java.lang.Exception
public static java.lang.String executeScript(java.lang.String script, ScriptItem item, java.util.Map<java.lang.String,java.lang.Object> additionalBindings) throws java.io.IOException, javax.script.ScriptException
script
is
null, as read from the file associated with the supplied
ScriptItem
. The engine is resolved via the filename extension
associated with item
(defaults to DEFAULT_SCRIPT
).
This is a convenience method for
executeScript(String, ScriptEngine, Map)
.
script
- The script in string form. Can be null.item
- The associated ScriptItem
. Must not be null. If
script
is null, the script content will be read
from the associated file. The script engine will be resolved
from the filename. The resource bundle associated with the
item
will be included in the bindings as
VAR_RESOURCES
.additionalBindings
- A map of bindings that will be included along with other
bindingsjava.io.IOException
javax.script.ScriptException
public static java.lang.Object executeScript(java.lang.String script, javax.script.ScriptEngine engine, java.util.Map<java.lang.String,java.lang.Object> additionalBindings) throws javax.script.ScriptException
script
- The script in string formengine
- The engineadditionalBindings
- A map of bindings that will be included along with other
bindingsjavax.script.ScriptException
public static java.util.List<java.lang.String> getAvailableScriptExtensions()