Examples

A simple example

Here is a simple example of tool for windows, that open the project database file (bdp) in an explorer window. The text should be saved in a file “openbdp.etool” located in the “extensions” subdirectory of the Atelier B installation directory (this directory may have to be created).

<externalTool name="openbdp"
       category="project"
       label="Open bdp"
       shortcut="Ctrl+Y"
       tooltip="Opens the project database directory in an explorer window"
       icon="openbdp.png"
       >
       <command>c:windowsexplorer.exe</command>
       <param>${projectBdp}</param>
</externalTool>

The file starts with the externalTool tag, which contains the required information as attributes (name, menu label, icon, etc…). Within the external tool, the following tags are used to describe the command:

  • command: the path to the executable file that will be started (here c:windowsexplorer.exe)

  • param: describes one parameter of the command. Here the command takes only one parameter, but for more complex commands with multiple parameters, there should be as many <param> as parameters.

The variable elements of the command (here the path to the bdp directory) are expressed using the ${variableName} notation. Here ${projectBdp} is replaced by the path to the bdp directory of the project.

A more complex example

The previous example had one major shortcoming: the path to the “explorer” executable is hardcoded. A better solution would be to allow the user to configure the path to the “explorer” executable. This can be done by using the toolParameter tag, that allows defining a new variable for using within the command. In that case, the corresponding etool file would be the following:

<externalTool name="openbdp"
      category="project"
      label="Open bdp"
      shortcut="Ctrl+Y"
      tooltip="Opens the project database directory in an explorer window"
      icon="openbdp.png"
      >
      <toolParameter name="explorer" type="exefile" default="c:windowsexplorer.exe" />

      <command>${explorer}</command>
      <param>${projectBdp}</param>
</externalTool>

Here, the toolParameter tag define a new variable that can be set by the user: a new tab is created in the “Preferences” dialog, that allows setting the path to the “explorer” executable (linux users could also provide a more suitable file manager).

Integration of ProB model-checker

ProB model-checker is now self generating the etool file for Atelier B (see Detailed procedure).

A sample file is provided below:

<externalTool category="component"   name="ProBTclTk" label="&Animate with ProB (Tcl/Tk)">
   <toolParameter name="editor" type="tool" configure="yes"
   default="c:/program files/prob/ProBWin.exe" />
   <command>${editor}</command>
   <param>${componentPath}</param>
   </externalTool>

Last updated