Package org.eclipse.ease.service
Interface IScriptService
- All Known Implementing Classes:
ScriptService
public interface IScriptService
Global service to create script engines and to query configuration data from the scripting extensions. To get the service instance use
final IScriptService scriptService = PlatformUI.getWorkbench().getService(IScriptService.class);
-
Field Summary
Fields Modifier and Type Field Description static boolean
TRACE_SCRIPT_SERVICE
Trace enablement for the script service. -
Method Summary
Modifier and Type Method Description void
addEngineListener(IScriptEngineLaunchExtension listener)
Add a listener for engine creations.IScriptEngine
createEngine(EngineDescription description)
Create an engine from a given description.Object
executeScript(String scriptLocation, String engineID, String... arguments)
Execute a given script and returns the execution result.Map<String,ModuleCategoryDefinition>
getAvailableModuleCategories()
Get a map of available module categories.Collection<ModuleDefinition>
getAvailableModules()
Get a map of available modules.Map<String,ScriptType>
getAvailableScriptTypes()
Get a map of available script tpye.EngineDescription
getEngine(String scriptType)
Get default engine for a given script type.EngineDescription
getEngineByID(String engineID)
Get a dedicated engine description.Collection<EngineDescription>
getEngines()
Get available engine descriptions.List<EngineDescription>
getEngines(String scriptType)
Get available engine descriptions for a given script type.Collection<IScriptEngineLaunchExtension>
getLaunchExtensions(EngineDescription engineDescription)
Get Launch extensions for a dedicated script engine.ModuleDefinition
getModuleDefinition(String moduleId)
Get the definition of the module with given ID.Collection<IScriptEngine>
getRunningEngines()
Get all running script engines.ScriptType
getScriptType(String location)
Get the script type for a given resource location.void
removeEngineListener(IScriptEngineLaunchExtension listener)
Remove a listener for engine creations.
-
Field Details
-
TRACE_SCRIPT_SERVICE
static final boolean TRACE_SCRIPT_SERVICETrace enablement for the script service.
-
-
Method Details
-
getEngineByID
Get a dedicated engine description. Allows to get an engine description for a dedicated engine identifier.- Parameters:
engineID
- engine identifier- Returns:
- script engine description or
null
-
getEngines
Collection<EngineDescription> getEngines()Get available engine descriptions.- Returns:
- available descriptions or empty collection
-
getEngines
Get available engine descriptions for a given script type. The resulting list is sorted by priority. Index 0 contains the engine with the highest priority.- Parameters:
scriptType
- type of script- Returns:
- available descriptions or empty collection
-
getEngine
Get default engine for a given script type. While there might exist multiple engines, the returned one has the highest priority.- Parameters:
scriptType
- type of script- Returns:
- engine description or
null
-
getAvailableModules
Collection<ModuleDefinition> getAvailableModules()Get a map of available modules. Keys contain the full module name, values contain its descriptor.- Returns:
- available modules or empty map
-
getAvailableModuleCategories
Map<String,ModuleCategoryDefinition> getAvailableModuleCategories()Get a map of available module categories. Keys contain the category id, values contain its descriptor.- Returns:
- available modules or empty map
-
getAvailableScriptTypes
Map<String,ScriptType> getAvailableScriptTypes()Get a map of available script tpye. Keys contain the type name, values contain its descriptor.- Returns:
- available script types or empty map
-
getLaunchExtensions
Get Launch extensions for a dedicated script engine.- Parameters:
engineDescription
- engine description for further filtering- Returns:
- launch extensions or empty collection
-
getScriptType
Get the script type for a given resource location.- Parameters:
location
- resource location- Returns:
- script type associated with file extension or
null
-
getModuleDefinition
Get the definition of the module with given ID.- Parameters:
moduleId
- id to look for- Returns:
- module definition
-
executeScript
Execute a given script and returns the execution result.- Parameters:
scriptLocation
- script location to executeengineID
- script engine ID ornull
to automatically select a matching enginearguments
- script arguments- Returns:
- script result
- Throws:
Throwable
- any exception thrown by the script
-
createEngine
Create an engine from a given description.- Parameters:
description
- engine description- Returns:
- script engine instance
-
getRunningEngines
Collection<IScriptEngine> getRunningEngines()Get all running script engines.- Returns:
- running engines
-
addEngineListener
Add a listener for engine creations. If already added, nothing will happen.- Parameters:
listener
- listener to add.
-
removeEngineListener
Remove a listener for engine creations.- Parameters:
listener
- listener to remove
-