Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EASE/Scripts

Scripts may be hosted on different locations. The simplest way to organize your scripts is to create a new project in the workspace and create script files there. As scripts are not bound to a dedicated project type you may add them to Java projects, your CDT projects or wherever you like.

Execution can be triggered via a quick launch (file context menu -> Run As -> EASE Script) or by using Run/Debug targets. If you are using the Script Shell View, you may also drag and drop your files there.

Script Libraries

To do something useful with your script, you need to interact with your environment. You may use modules for that purpose or provide java code. But you may also create your own script libraries. Engines support an include(location) command, that allows to write libraries in your script language and load them on demand. Besides relative paths you may use URIs here. We have added additional schemes like workspace:// which refers to your workspace root and project:// which refers to the root of the current project (in respect to the currently executed file).

Script Locations

An alternate way to manage your scripts is to provide locations, where EASE can parse for scripts. You may add such locations in the preferences / Scripting / Script Locations. Currently we support workspace folders, file system paths, http URIs to some extent and platfom:/plugin URIs. In the future additional URIs will be supported like ftp, ... EASE searches those locations on a regular basis and displays found scripts in the Scripts Explorer View. From there you may edit or execute them directly. Furthermore you may access such scripts using the script:// scheme. The Script Shell View is capable of recording your actions and store them to the default Script Location. Recording can be enabled in the view toolbar.

Scripts support magic headers, a comment section at the very beginning of the file containing key:value pairs. Changes are reflected immediately for workspace resources or after a refresh triggered in the Script Explorer view. Supported keys are:

Key Description
name Script name displayed. May use / to create folder structures. Defaults to the filename.
description Script description. Used as a tooltip on the script.
toolbar Bind a script to a view toolbar. Provide either view ID or view title (eg Project Explorer).
menu Bind a script to a view menu. Provide either view ID or view title (eg Project Explorer).
popup Bind a script to a popup menu. Add an expression like enableFor(full.qualified.class.name). If the selection is an instance from that type or adaptable to it, the popup menu will be added.
keyboard Binds a script to a keyboard shortcut. Syntax for keyboard mappings is the same as in the 'Keys' preferences page.
image Add a dedicated toolbar/menu image. Accepts local file paths, relative paths (according to the script file) or URIs. Accepted URI schemes are http;//, platform:/plugin, workspace://, file://
script-type Script type of this source. Typically the type is denoted from the file extension. This keyword explicitely sets the type.
script-engine Comma separated list of engine IDs of valid engines for this script. Preceeding an engine with ! explicitely disables an engine ID.
io Define where IO comes from/goes to: 'system' uses System.out/err/in; 'none' no IO at all; any other uses a console
onStartup Run a script on Eclipse/RCP startup. If an integer parameter is provided, it denotes the script startup delay in seconds.
onShutdown Run a script on Eclipse/RCP shutdown. If an integer parameter is provided, it denotes the maximum script execution time in seconds (defaults to 10s).
onSave Run a script on an editor save action. A wildcard pattern may be used to denote on which files a the script should trigger (eg: '*.js'). Parameter argv[0] holds the resource description of the saved file.
onResourceChange Run a script on a resource change in the workspace. A wildcard pattern may be used to denote on which files a the script should trigger (eg: '*.js'). Parameter argv[0] holds the resource description of the changed file, argv[1] the type of the change.
onEventBus Run scripts when a specific event is posted on the OSGI message bus. Accepts a channel identifier for broker subscription (* wildcards may be used). The event will be passed to the script as variable 'event'.

Back to the top