org.eclipse.ease.lang.javascript.rhino

## Class RhinoScriptEngine

- java.lang.Object
- - org.eclipse.core.runtime.PlatformObject
  - - org.eclipse.core.internal.jobs.InternalJob
    - - org.eclipse.core.runtime.jobs.Job
      - - org.eclipse.ease.AbstractScriptEngine
        - - org.eclipse.ease.AbstractReplScriptEngine
          - - org.eclipse.ease.lang.javascript.rhino.RhinoScriptEngine

All Implemented Interfaces:
  java.lang.Comparable, IAdaptable, IReplEngine, IScriptEngine

Direct Known Subclasses:
  RhinoDebuggerEngine

    public class RhinoScriptEngine
    extends AbstractReplScriptEngine

A script engine to execute JavaScript code on a Rhino interpreter.

### Field Summary

Fields
`static java.lang.String` `ENGINE_ID`

### Fields inherited from class org.eclipse.core.runtime.jobs.Job

`ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING`

### Fields inherited from interface org.eclipse.ease.IScriptEngine

`TRACE_SCRIPT_ENGINE`

### Constructor Summary

Constructors
Constructor and Description
`RhinoScriptEngine()` Creates a new Rhino interpreter.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static org.mozilla.javascript.Context` `getContext()`
`ScriptStackTrace` `getExceptionStackTrace()`
`org.mozilla.javascript.ScriptableObject` `getScope()` Method to get the global scope of this engine.
`ScriptObjectType` `getType(java.lang.Object object)` Get type information on a given script object
`java.util.Map<java.lang.String,java.lang.Object>` `getVariables(org.mozilla.javascript.Scriptable scope)`
`void` `registerJar(java.net.URL url)` Register a jar file and add it to the classpath.
`void` `setOptimizationLevel(int level)`
`void` `terminateCurrent()` Stops the currently executed piece of code.
`java.lang.String` `toString(java.lang.Object object)` Get the String representation of a script object.

### Methods inherited from class org.eclipse.ease.AbstractReplScriptEngine

`getDefinedVariables, getLastExecutionResult, getTerminateOnIdle, isIdle, setTerminateOnIdle, terminate`

### Methods inherited from class org.eclipse.ease.AbstractScriptEngine

`addExecutionListener, addSecurityCheck, executeAsync, executeSync, extractArguments, getCurrentScriptEngine, getDescription, getErrorStream, getExecutedFile, getInputStream, getLaunch, getMonitor, getOutputStream, getStackTrace, getVariable, getVariables, hasVariable, inject, injectUI, isFinished, join, removeExecutionListener, removeSecurityCheck, setCloseStreamsOnTerminate, setEngineDescription, setErrorStream, setExecutionRootFile, setInputStream, setLaunch, setOutputStream, setVariable`

### Methods inherited from class org.eclipse.core.runtime.jobs.Job

`addJobChangeListener, belongsTo, cancel, create, create, createSystem, createSystem, createSystem, done, getJobGroup, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, join, removeJobChangeListener, schedule, schedule, setJobGroup, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, toString, wakeUp, wakeUp, yieldRule`

### Methods inherited from class org.eclipse.core.internal.jobs.InternalJob

`compareTo`

### Methods inherited from class org.eclipse.core.runtime.PlatformObject

`getAdapter`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.ease.IScriptEngine

`addExecutionListener, addSecurityCheck, executeAsync, executeSync, getDescription, getErrorStream, getExecutedFile, getInputStream, getLaunch, getMonitor, getName, getOutputStream, getVariable, getVariables, hasVariable, inject, injectUI, isFinished, join, removeExecutionListener, removeSecurityCheck, schedule, setCloseStreamsOnTerminate, setErrorStream, setInputStream, setOutputStream, setVariable`

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

### Field Detail

#### ENGINE_ID

    public static final java.lang.String ENGINE_ID

See Also:
  Constant Field Values

### Constructor Detail

#### RhinoScriptEngine

    public RhinoScriptEngine()

Creates a new Rhino interpreter.

### Method Detail

#### getContext

    public static org.mozilla.javascript.Context getContext()

#### setOptimizationLevel

    public void setOptimizationLevel(int level)

#### getExceptionStackTrace

    public ScriptStackTrace getExceptionStackTrace()

#### terminateCurrent

    public void terminateCurrent()

Description copied from interface: `IScriptEngine`
Stops the currently executed piece of code. Will continue to execute the next scheduled piece of code.

#### registerJar

    public void registerJar(java.net.URL url)

Description copied from interface: `IScriptEngine`
Register a jar file and add it to the classpath. After registering, classes within the jar file shall be usable within the script.

Parameters:
  `url` - url to load jar file from

#### getVariables

    public java.util.Map<java.lang.String,java.lang.Object> getVariables(org.mozilla.javascript.Scriptable scope)

#### getScope

    public org.mozilla.javascript.ScriptableObject getScope()

Method to get the global scope of this engine.

Returns:
  fScope

#### getType

    public ScriptObjectType getType(java.lang.Object object)

Description copied from interface: `IReplEngine`
Get type information on a given script object

Specified by:
  `getType` in interface `IReplEngine`
Overrides:
  `getType` in class `AbstractReplScriptEngine`
Parameters:
  `object` - object to inspect
Returns:
  object type

#### toString

    public java.lang.String toString(java.lang.Object object)

Description copied from interface: `IReplEngine`
Get the String representation of a script object. A script object can be an execution result or a variable content.

Specified by:
  `toString` in interface `IReplEngine`
Overrides:
  `toString` in class `AbstractReplScriptEngine`
Parameters:
  `object` - script object
Returns:
  String representation