Class BeanShellFacade<T>
java.lang.Object
org.gjt.sp.jedit.BeanShellFacade<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEvaluates the specified BeanShell expression.cacheBlock(String id, String code, boolean namespace) Caches a block of code, returning a handle that can be passed to runCachedBlock().protected static InterpretercreateInterpreter(NameSpace nameSpace) Evaluates the specified BeanShell expression with the global namespaceEvaluates the specified BeanShell expression.voidevalSelection(T param, TextArea textArea) Evaluates the text selected in the specified text area.protected abstract voidhandleException(T param, String path, Throwable t) protected voidinit()Initialize things.protected abstract voidresetDefaultVariables(NameSpace namespace) runCachedBlock(BshMethod method, T param, NameSpace namespace) Runs a cached block of code in the specified namespace.protected abstract voidsetupDefaultVariables(NameSpace namespace, T param) protected voidsetVariable(NameSpace nameSpace, String name, Object object) Set a beanshell variable in the namespace without overriding itprotected static voidThis extracts an exception from a 'wrapping' exception, as BeanShell sometimes throws.
-
Field Details
-
global
-
classManager
-
-
Constructor Details
-
BeanShellFacade
protected BeanShellFacade()
-
-
Method Details
-
init
protected void init()Initialize things. It is called by the constructor. You can override it to import other packages -
evalSelection
-
eval
-
eval
-
_eval
Evaluates the specified BeanShell expression. Unlikeeval(), this method passes any exceptions to the caller.- Parameters:
view- The view. Within the script, references tobuffer,textAreaandeditPaneare determined with reference to this parameter.namespace- The namespacecommand- The expression- Returns:
- an object
- Throws:
Exception- instances are thrown when various BeanShell errors occur
-
cacheBlock
Caches a block of code, returning a handle that can be passed to runCachedBlock().- Parameters:
id- An identifier.code- The codenamespace- If true, the namespace will be set- Returns:
- a hsh method
- Throws:
Exception- instances are thrown when various BeanShell errors occur
-
runCachedBlock
Runs a cached block of code in the specified namespace. Faster than evaluating the block each time.- Parameters:
method- The method instance returned by cacheBlock()param- a parameternamespace- The namespace to run the code in- Returns:
- an object
- Throws:
Exception- instances are thrown when various BeanShell errors occur
-
getNameSpace
- Returns:
- the global namespace.
-
setVariable
Set a beanshell variable in the namespace without overriding it- Parameters:
nameSpace- the namespacename- the name of the variableobject- the value of the variable- Throws:
UtilEvalError- when there is an error
-
setupDefaultVariables
- Throws:
UtilEvalError
-
resetDefaultVariables
- Throws:
UtilEvalError
-
handleException
-
createInterpreter
-
unwrapException
-