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 Details

    • TRACE_SCRIPT_SERVICE

      static final boolean TRACE_SCRIPT_SERVICE
      Trace enablement for the script service.
  • Method Details

    • getEngineByID

      EngineDescription getEngineByID(String engineID)
      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

      Get available engine descriptions.
      Returns:
      available descriptions or empty collection
    • getEngines

      List<EngineDescription> getEngines(String scriptType)
      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

      EngineDescription getEngine(String scriptType)
      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

      Collection<IScriptEngineLaunchExtension> getLaunchExtensions(EngineDescription engineDescription)
      Get Launch extensions for a dedicated script engine.
      Parameters:
      engineDescription - engine description for further filtering
      Returns:
      launch extensions or empty collection
    • getScriptType

      ScriptType getScriptType(String location)
      Get the script type for a given resource location.
      Parameters:
      location - resource location
      Returns:
      script type associated with file extension or null
    • getModuleDefinition

      ModuleDefinition getModuleDefinition(String moduleId)
      Get the definition of the module with given ID.
      Parameters:
      moduleId - id to look for
      Returns:
      module definition
    • executeScript

      Object executeScript(String scriptLocation, String engineID, String... arguments) throws Throwable
      Execute a given script and returns the execution result.
      Parameters:
      scriptLocation - script location to execute
      engineID - script engine ID or null to automatically select a matching engine
      arguments - script arguments
      Returns:
      script result
      Throws:
      Throwable - any exception thrown by the script
    • createEngine

      IScriptEngine createEngine(EngineDescription description)
      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

      void addEngineListener(IScriptEngineLaunchExtension listener)
      Add a listener for engine creations. If already added, nothing will happen.
      Parameters:
      listener - listener to add.
    • removeEngineListener

      void removeEngineListener(IScriptEngineLaunchExtension listener)
      Remove a listener for engine creations.
      Parameters:
      listener - listener to remove