Package org.eclipse.ease
Class Script
java.lang.Object
org.eclipse.ease.Script
Scriptable object. Consists of scriptable data and a result container.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getCode()
Get the scriptable data asString
.Get the scriptable data asInputStream
.final Object
Returns the command object of this script.getFile()
Returns the file instance, if the current command is backed by a file.final ScriptResult
Get execution result.getTitle()
Get the title of this script.int
hashCode()
boolean
Check if this script is defined by dynamically generated code.boolean
Script originated from interactive input or shell, as opposed to a source file.final void
Set an execution exception.final void
Set the execution result.toString()
-
Constructor Details
-
Script
Constructor.- Parameters:
title
- name of script objectcommand
- command (sequence) to be executedisShell
-true
if the script originated from a shell/interactive session
-
Script
Constructor.- Parameters:
title
- name of script objectcommand
- command (sequence) to be executed
-
Script
Constructor. Using no title for this script- Parameters:
command
- command (sequence) to be executed
-
-
Method Details
-
getCodeStream
Get the scriptable data asInputStream
. The caller needs to close the stream when it is not used anymore. Calling this method multiple times will return different streams with the same text content.- Returns:
- scriptable data
- Throws:
IOException
- when stream cannot be established
-
getCode
Get the scriptable data asString
.- Returns:
- scriptable data
- Throws:
IOException
- when code cannot be read from source
-
getCommand
Returns the command object of this script.- Returns:
- command object
-
getResult
Get execution result.- Returns:
- execution result.
-
setResult
Set the execution result.- Parameters:
result
- execution result
-
setException
Set an execution exception.- Parameters:
e
- exception
-
getFile
Returns the file instance, if the current command is backed by a file.- Returns:
IFile
,File
ornull
-
isDynamic
public boolean isDynamic()Check if this script is defined by dynamically generated code. Generated code might be hidden while debugging.- Returns:
true
when not a file and not anURL
-
toString
-
getTitle
Get the title of this script. Title has to be set by the caller via the constructor. Typically this is used for dynamic code to indicate its purpose. If no title is set we try to extract the name of the executed resource.- Returns:
- script title or
null
-
isShellMode
public boolean isShellMode()Script originated from interactive input or shell, as opposed to a source file. A script engine may decide to process a script originating in the shell differently than one originating in a source file.- Returns:
true
origin is interactive input or shell, orfalse
if origin is a source file.
-
hashCode
public int hashCode() -
equals
-