#### 16.7.2 Tool example

This section provides an example that defines a new tool. This is only a short example, since Ada, C and C++ support themselves are provided through such a file, available in the GPS installation.

This example adds support for the "find" Unix utility, with a few switches. All these switches are editable through the project properties editor.

It also adds a new action and menu. The action associated with this menu gets the default switches from the currently selected project, and then ask the user interactively for the name of the file to search.

         <?xml version="1.0" ?>
         <toolexample>
           <tool name="Find" >
             <switches columns="2" >
               <title column="1" >Filters</title>
               <title column="2" >Actions</title>

               <spin label="Modified less than n days ago" switch="-mtime-"
                     min="0" max="365" default="0" />
               <check label="Follow symbolic links" switch="-follow" />

               <check label="Print matching files" switch="-print" column="2" />
             </switches>
           </tool>

           <action name="action find">
             <shell>Project %p</shell>
             <shell>Project.get_tool_switches_as_string %1 Find </shell>
             <shell>MDI.input_dialog "Name of file to search" Filename</shell>
             <external>find . -name %1 %2</external>
           </action>

           <Submenu>
             <Title>External</Title>
              <menu action="action find">
                <Title>Launch find</Title>
             </menu>
           </Submenu>
         </toolexample>