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.lang.javascript.rhino.RhinoScriptEngine

All Implemented Interfaces:
  Comparable, IAdaptable, IScriptEngine

Direct Known Subclasses:
  RhinoDebuggerEngine

    public class RhinoScriptEngine
    extends AbstractScriptEngine

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

### Field Summary

Fields
`static 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
`org.mozilla.javascript.Context` `getContext()`
`String` `getSaveVariableName(String name)` Return a save name to be used for a variable.
`static Object` `getVariable(org.mozilla.javascript.Scriptable scope, String name)`
`static Map<String,Object>` `getVariables(org.mozilla.javascript.Scriptable scope)`
`void` `registerJar(URL url)` Register a jar file and add it to the classpath.
`void` `setDebugger(org.mozilla.javascript.debug.Debugger debugger)`
`void` `setOptimizationLevel(int level)`
`void` `terminateCurrent()` Stops the currently executed piece of code.

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

`addExecutionListener, addSecurityCheck, executeAsync, executeSync, extractArguments, getDescription, getErrorStream, getExecutedFile, getInputStream, getOutputStream, getStackTrace, getTerminateOnIdle, getVariable, getVariables, hasVariable, inject, injectUI, isFinished, isIdle, join, removeExecutionListener, removeSecurityCheck, removeVariable, setCloseStreamsOnTerminate, setEngineDescription, setErrorStream, setInputStream, setOutputStream, setTerminateOnIdle, setVariable, terminate`

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

`addJobChangeListener, belongsTo, cancel, create, create, 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

`getName, schedule`

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

`getAdapter`

### Field Detail

#### ENGINE_ID

    public static final String ENGINE_ID

See Also:
  Constant Field Values

### Constructor Detail

#### RhinoScriptEngine

    public RhinoScriptEngine()

Creates a new Rhino interpreter.

### Method Detail

#### setOptimizationLevel

    public void setOptimizationLevel(int level)

#### getContext

    public org.mozilla.javascript.Context getContext()

#### 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.

#### setDebugger

    public void setDebugger(org.mozilla.javascript.debug.Debugger debugger)

#### registerJar

    public void registerJar(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 static Map<String,Object> getVariables(org.mozilla.javascript.Scriptable scope)

#### getVariable

    public static Object getVariable(org.mozilla.javascript.Scriptable scope,
                                     String name)

#### getSaveVariableName

    public String getSaveVariableName(String name)

Description copied from interface: `IScriptEngine`
Return a save name to be used for a variable. The returned value denotes a valid name to be used for a variable within this engine. The returned name might already be in use.

Parameters:
  `name` - variable name candidate
Returns:
  converted variable name