RAD Studio
ContentsIndex
PreviousUpNext
Overview of the Tools API

All of the Tools API declarations reside in a single unit, ToolsAPI. To use the Tools API, you typically use the designide package, which means you must build your Tools API add-in as a design-time package or as a DLL that uses runtime packages. For information about package and library issues, see Installing the wizard package

The main interface for writing a Tools API extension is IOTAWizard, so most IDE add-ins are called wizards. C++Builder and Delphi wizards are, for the most part, interoperable. You can write and compile a wizard in Delphi, then use it in C++Builder, and vice versa. Interoperability works best with the same version number, but it is also possible to write wizards so they can be used in future versions of both products. 

To use the Tools API, you write wizard classes that implement one or more of the interfaces defined in the ToolsAPI unit. 

A wizard makes use of services that the Tools API provides. Each service is an interface that presents a set of related functions. The implementation of the interface is hidden within the IDE. The Tools API publishes only the interface, which you can use to write your wizards without concerning yourself with the implementation of the interfaces. The various services offer access to the source editor, form designer, debugger, and so on. See Obtaining Tools API services for information about using the interfaces that expose services to your wizard. 

The service and other interfaces fall into two basic categories. You can tell them apart by the prefix used for the type name:

  • The NTA (native tools API) grants direct access to actual IDE objects, such as the IDE's TMainMenu object. When using these interfaces, the wizard must use CodeGear packages, which also means the wizard is tied to a specific version of the IDE. The wizard can reside in a design-time package or in a DLL that uses runtime packages.
  • The OTA (open tools API) does not require packages and accesses the IDE only through interfaces. In theory, you could write a wizard in any language that supports COM-style interfaces, provided you can also work with the Delphi calling conventions and Delphi types such as AnsiString. OTA interfaces do not grant full access to the IDE, but almost all the functionality of the Tools API is available through OTA interfaces. If a wizard uses only OTA interfaces, it is possible to write a DLL that is not dependent on a specific version of the IDE.
The Tools API has two kinds of interfaces: those that you, the programmer, must implement and those that the IDE implements. Most of the interfaces are in the latter category: the interfaces define the capability of the IDE but hide the actual implementation. The kinds of interfaces that you must implement fall into three categories: wizards, notifiers, and creators:
  • As mentioned earlier in this topic, a wizard class implements the IOTAWizard interface and possibly derived interfaces.
  • A notifier is another kind of interface in the Tools API. The IDE uses notifiers to call back to your wizard when something interesting happens. You write a class that implements the notifier interface, register the notifier with the Tools API, and the IDE calls back to your notifier object when the user opens a file, edits source code, modifies a form, starts a debugging session, and so on. Notifiers are covered in Notifying a wizard of IDE events .
  • A creator is another kind of interface that you must implement. The Tools API uses creators to create new units, projects, or other files, or to open existing files. See Creating forms and projects for information about creator interfaces.
Other important interfaces are modules and editors. A module interface represents an open unit, which has one or more files. An editor interface represents an open file. Different kinds of editor interfaces give you access to different aspects of the IDE: the source editor for source files, the form designer for form files, and project resources for a resource file. See Working with files and editors for information about module and editor interfaces.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!