Package org.eclipse.ease
Class Script
java.lang.Object
org.eclipse.ease.Script
public class Script extends Object
Scriptable object. Consists of scriptable data and a result container.
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description booleanequals(Object obj)StringgetCode()Get the scriptable data asString.InputStreamgetCodeStream()Get the scriptable data asInputStream.ObjectgetCommand()Returns the command object of this script.ObjectgetFile()Returns the file instance, if the current command is backed by a file.ScriptResultgetResult()Get execution result.StringgetTitle()Get the title of this script.inthashCode()booleanisDynamic()Check if this script is defined by dynamically generated code.booleanisShellMode()Script originated from interactive input or shell, as opposed to a source file.voidsetException(ScriptExecutionException e)Set an execution exception.voidsetResult(Object result)Set the execution result.StringtoString()
-
Constructor Details
-
Script
Constructor.- Parameters:
title- name of script objectcommand- command (sequence) to be executedisShell-trueif 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,Fileornull
-
isDynamic
public boolean isDynamic()Check if this script is defined by dynamically generated code. Generated code might be hidden while debugging.- Returns:
truewhen 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:
trueorigin is interactive input or shell, orfalseif origin is a source file.
-
hashCode
public int hashCode() -
equals
-