I wrote this application to help me (and hopefully you) to find Open Tools API (OTA) interfaces, methods and properties and understand how to get to those interfaces or methods / properties of the interfaces.
The interface of the application is hopefully fairly simple. There are 2 main tabs to the interface. One contains the list (filtered) of interfaces, methods and properties from the files you’ve asked to be searched and a tabbed pane and second tab containing the list of file searches. The bottom panel of the first tab contains a view of the source code for the item you have selected above and the second tab contains a tree view of paths to get to the interface / method or property you have selected above.
To set up the application, first go to the second main tab and click the add button at the bottom of the tab to add a search path.
You will be asked to browse to a path, so browse to you installation of RAD Studio and to the
ToolsAPI folder in the
Source directory. (for instance
C:\Program Files (x86)\Embarcadero\Studio\18.0\Source\ToolsAPI\).
By default the file filter will be
ToolsAPI.pas. You can change this to a file wildcard search to include all
.pas files (for instance
*.pas). As you add search paths the application will search those paths and present a list of interfaces, methods and properties of those interfaces.
The list of interfaces and their methods and properties can be filtered (searched for) by typing a regular expression into the filter box at the top of the main tab. I’m not going to list the regular expression syntax here however I’ve used the
TRegEx class from RAD Studio which implements the Perl 5 Regular Expression syntax.
When you type a filter criteria there is a small delay and then the tree view of the interfaces and their methods and properties are filtered.
If you hover the mouse over an interface, method or property you will get a hint containing the interface, method or property along with the associated comment if it exists in the source code.
When you select an item in the interfaces / methods / properties list the code preview pane will display the underlying source code for you as follows:
- Selecting a filename displays the start of the source code file selected;
- Selecting an interface displays the interface definition centred in the viewer;
- Selecting a method or property displays the method or property definition centred in the viewer.
Viewing Code Paths
If when you select an interface, method or property and you are on the Code Tree bottom tab the application will search all the permutations that will provide you with access to that interface, method or property. It will also highlight the shortest path to the interface, method or property from a service interface.
The code tree view will also display some special nodes while searching as follows:
- Service Interfaces: An interface of the form
IOTAXxxxxServicesthat can be obtained from the
- Notifiers: Notifier interfaces with paths to the addition of the notifier to the IDE;
- Castings: Numerous interfaces that are obtained from casting one interface to another;
- Loops where the path can loop round to a position further towards the start of the current path.
Please note that the number of permutation that can be found can be in the hundreds of thousands and even up towards the million mark. Because of this it can take a number of seconds to find all the permutations which are then dislpayed in a collapsed tree view with the shortest path to the interface, method or property expanded and highlighted.
The small panel below attempts to summaries the path to the interface.
In version 1.1 you can now do a target search be entering an second search criteria in the Target Search box at the top of the main Interfaces tab.
This adds a second highlight to any code shown in the tree views but more importantly it limits (filters) the OTA Code Tree at the bottom of the application to only show search paths to node that match the target search criteria.
Downloading the code and application
You can download the application (built with RAD Studio Berlin 10.1) and the source code from the below links (You will need VirtualTreeView and SynEdit components to compile the project):