|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gjt.sp.jedit.BeanShell
BeanShell is jEdit's extension language.
When run from jEdit, BeanShell code has access to the following predefined variables:
view
- the currently active View
.editPane
- the currently active EditPane
.textArea
- the edit pane's JEditTextArea
.buffer
- the edit pane's Buffer
.wm
- the view's DockableWindowManager
.scriptPath
- the path name of the currently executing
BeanShell script.
Constructor Summary | |
BeanShell()
|
Method Summary | |
static java.lang.Object |
_eval(View view,
NameSpace namespace,
java.lang.String command)
Evaluates the specified BeanShell expression. |
static void |
_runScript(View view,
java.lang.String path,
java.io.Reader in,
boolean ownNamespace)
Runs a BeanShell script. |
static void |
_runScript(View view,
java.lang.String path,
java.io.Reader in,
NameSpace namespace)
Runs a BeanShell script. |
static BshMethod |
cacheBlock(java.lang.String id,
java.lang.String code,
boolean namespace)
Caches a block of code, returning a handle that can be passed to runCachedBlock(). |
static java.lang.Object |
eval(View view,
NameSpace namespace,
java.lang.String command)
Evaluates the specified BeanShell expression. |
static java.lang.Object |
eval(View view,
NameSpace namespace,
java.lang.String command,
boolean rethrowBshErrors)
Deprecated. The rethrowBshErrors parameter is now
obsolete; call _eval() or eval() instead. |
static java.lang.Object |
eval(View view,
java.lang.String command,
boolean rethrowBshErrors)
Deprecated. The rethrowBshErrors parameter is now
obsolete; call _eval() or eval() instead. |
static void |
evalSelection(View view,
JEditTextArea textArea)
Evaluates the text selected in the specified text area. |
static NameSpace |
getNameSpace()
Returns the global namespace. |
static boolean |
isScriptRunning()
Returns if a BeanShell script or macro is currently running. |
static java.lang.Object |
runCachedBlock(BshMethod method,
View view,
NameSpace namespace)
Runs a cached block of code in the specified namespace. |
static void |
runScript(View view,
java.lang.String path,
boolean ownNamespace,
boolean rethrowBshErrors)
Deprecated. The rethrowBshErrors parameter is now
obsolete; call _runScript() or runScript()
instead. |
static void |
runScript(View view,
java.lang.String path,
java.io.Reader in,
boolean ownNamespace)
Runs a BeanShell script. |
static void |
runScript(View view,
java.lang.String path,
java.io.Reader in,
boolean ownNamespace,
boolean rethrowBshErrors)
Deprecated. The rethrowBshErrors parameter is now
obsolete; call _runScript() or runScript()
instead. |
static void |
runScript(View view,
java.lang.String path,
java.io.Reader in,
NameSpace namespace)
Runs a BeanShell script. |
static void |
showEvaluateDialog(View view)
Prompts for a BeanShell expression to evaluate. |
static void |
showEvaluateLinesDialog(View view)
Evaluates the specified script for each selected line. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BeanShell()
Method Detail |
public static void evalSelection(View view, JEditTextArea textArea)
public static void showEvaluateDialog(View view)
public static void showEvaluateLinesDialog(View view)
public static void runScript(View view, java.lang.String path, java.io.Reader in, boolean ownNamespace)
If the in
parameter is non-null, the script is
read from that stream; otherwise it is read from the file identified
by path
.
The scriptPath
BeanShell variable is set to the path
name of the script.
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.path
- The script file's VFS path.in
- The reader to read the script from, or null
.ownNamespace
- If set to false
, methods and
variables defined in the script will be available to all future
uses of BeanShell; if set to true
, they will be lost as
soon as the script finishes executing. jEdit uses a value of
false
when running startup scripts, and a value of
true
when running all other macros.public static void runScript(View view, java.lang.String path, java.io.Reader in, NameSpace namespace)
If the in
parameter is non-null, the script is
read from that stream; otherwise it is read from the file identified
by path
.
The scriptPath
BeanShell variable is set to the path
name of the script.
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.path
- The script file's VFS path.in
- The reader to read the script from, or null
.namespace
- The namespace to run the script in.public static void _runScript(View view, java.lang.String path, java.io.Reader in, boolean ownNamespace) throws java.lang.Exception
If the in
parameter is non-null, the script is
read from that stream; otherwise it is read from the file identified
by path
.
The scriptPath
BeanShell variable is set to the path
name of the script.
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.path
- The script file's VFS path.in
- The reader to read the script from, or null
.ownNamespace
- If set to false
, methods and
variables defined in the script will be available to all future
uses of BeanShell; if set to true
, they will be lost as
soon as the script finishes executing. jEdit uses a value of
false
when running startup scripts, and a value of
true
when running all other macros.
java.lang.Exception
- instances are thrown when various BeanShell errors
occurpublic static void _runScript(View view, java.lang.String path, java.io.Reader in, NameSpace namespace) throws java.lang.Exception
If the in
parameter is non-null, the script is
read from that stream; otherwise it is read from the file identified
by path
.
The scriptPath
BeanShell variable is set to the path
name of the script.
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.path
- The script file's VFS path.in
- The reader to read the script from, or null
.namespace
- The namespace to run the script in.
java.lang.Exception
- instances are thrown when various BeanShell errors
occurpublic static java.lang.Object eval(View view, NameSpace namespace, java.lang.String command)
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.namespace
- The namespacecommand
- The expressionpublic static java.lang.Object _eval(View view, NameSpace namespace, java.lang.String command) throws java.lang.Exception
eval()
, this method passes any exceptions to the caller.
view
- The view. Within the script, references to
buffer
, textArea
and editPane
are determined with reference to this parameter.namespace
- The namespacecommand
- The expression
java.lang.Exception
- instances are thrown when various BeanShell
errors occurpublic static BshMethod cacheBlock(java.lang.String id, java.lang.String code, boolean namespace) throws java.lang.Exception
id
- An identifier. If null, a unique identifier is generatedcode
- The codenamespace
- If true, the namespace will be set
java.lang.Exception
- instances are thrown when various BeanShell errors
occurpublic static java.lang.Object runCachedBlock(BshMethod method, View view, NameSpace namespace) throws java.lang.Exception
method
- The method instance returned by cacheBlock()view
- The viewnamespace
- The namespace to run the code in
java.lang.Exception
- instances are thrown when various BeanShell
errors occurpublic static boolean isScriptRunning()
public static NameSpace getNameSpace()
public static void runScript(View view, java.lang.String path, boolean ownNamespace, boolean rethrowBshErrors)
rethrowBshErrors
parameter is now
obsolete; call _runScript()
or runScript()
instead.
public static void runScript(View view, java.lang.String path, java.io.Reader in, boolean ownNamespace, boolean rethrowBshErrors)
rethrowBshErrors
parameter is now
obsolete; call _runScript()
or runScript()
instead.
public static java.lang.Object eval(View view, java.lang.String command, boolean rethrowBshErrors)
rethrowBshErrors
parameter is now
obsolete; call _eval()
or eval()
instead.
public static java.lang.Object eval(View view, NameSpace namespace, java.lang.String command, boolean rethrowBshErrors)
rethrowBshErrors
parameter is now
obsolete; call _eval()
or eval()
instead.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |