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
FieldsModifier and TypeFieldDescriptionstatic final boolean
Trace enablement for the script service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener for engine creations.createEngine
(EngineDescription description) Create an engine from a given description.executeScript
(String scriptLocation, String engineID, String... arguments) Execute a given script and returns the execution result.Get a map of available module categories.Get a map of available modules.Get a map of available script tpye.Get default engine for a given script type.getEngineByID
(String engineID) Get a dedicated engine description.Get available engine descriptions.getEngines
(String scriptType) Get available engine descriptions for a given script type.getLaunchExtensions
(EngineDescription engineDescription) Get Launch extensions for a dedicated script engine.getModuleDefinition
(String moduleId) Get the definition of the module with given ID.Get all running script engines.getScriptType
(String location) Get the script type for a given resource location.void
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
-