Extending the IDE Using the Tools API

From RAD Studio
(Redirected from Extending the IDE Index)
Jump to: navigation, search

Go Up to VCL Component Writer's Guide Index


You can extend and customize the RAD Studio IDE with your own menu items, tool bar buttons, dynamic form-creation wizards, and more, using the Tools API.

The Tools API is a suite of over 100 interfaces that interact with and control the IDE, including the main menu, the tool bars, the main action list and image list, the source editor's internal buffers, keyboard macros and bindings, forms and their components in the form editor, the debugger and the process being debugged, code completion, the message view, and the to-do list.

To extend the IDE with new features using the Tools API:

  1. Create a package and configure it to extend the IDE. You may also use an existing package.
  2. Implement the logic of your IDE extension.
  3. Install your extension onto the IDE.

Creating or Extending a Package to Extend the IDE

To extend the IDE using the Tools API you must first create or extend a package so that it can use the Tools API.

Once you have a package, you can implement your code using a data module. Add a data module to your package, change its framework affinity to the VCL, and use its OnCreate and OnDestroy events to define code to create and destroy your IDE extension.

Alternatively, you may define your extension in a unit of your package or in the main source code file of your package.

Implementing the Logic of Your IDE Extension

The code in your package can use services that the Tools API provides. Each service is an interface that presents a set of related functions. The various services offer access to the Code Editor, the Form Designer, the debugger, and so on.

Additionally, you may use special interfaces to implement certain features, such as wizards, notifiers, creators, modules, editors, and more.

All of the Tools API interfaces are declared in the units that you can find at C:\Program Files (x86)\Embarcadero\Studio\23.0\source\ToolsAPI. You can check the contents of those units to discover new ways to extend the IDE. The library reference documentation does not generally provide reference documentation of the Tools API. However, there is reference documentation available for the PlatformAPI unit of the Tools API.

Differences Between Native and Open Tools API Interfaces

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 TMainMenu object of the IDE. When using these interfaces, the wizard must use RAD Studio 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 run-time 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.

Conventions to Follow When You Extend the IDE

The Tools API gives you flexibility to extend the IDE in many different ways. When you extend the IDE, make sure that your extensions integrate nicely into the IDE and that they do not get on the way of the core features of the IDE.

These are some conventions that you should follow when you extend the IDE:

  • If you provide menu items to open external tools, provide those on the Tools menu.
  • If you provide menu items to open help resources:
    • If you provide a single help menu entry, place a menu entry within Help > Third-Party Help that displays the name of your product.
    • If you provide several help menu items (for example, an entry for offline help and an entry for online help), place a menu entry within Help > Third-Party Help that displays the name of your product, and then include your help menu items as child menu items of that help menu entry.
See:

IDE Extensions Must Support Large Memory Addresses

The IDE is large-address-aware, which allows the IDE to use up to 4 GiB of memory. Because of this, IDE extensions must also be able to handle large memory addresses.

Most IDE extensions should support large memory addresses. The following list contains some tips to help you detect issues in your IDE extension:

Installing Your Extension Package Onto the IDE

Once your package is ready, to use your package you must compile it and load it onto the IDE.

IOTAVersionSKUInfoService Interface

This interface allows you to query the list of installed platforms, SKU, and if the running IDE is a Trial version:

property SKU: Integer read GetSKU;

property IsProductTrial: Boolean read GetIsProductTrial;

property Platforms: TArray<TPlatformIds> read GetPlatforms;

The SKU identifiers are documented in the ToolsAPI.pas file where the interface is defined.

You can use PlatformAPI.PlatformIDToName to convert the platform IDs to a human-readable names. The IDs are documented in System.Classes.

Installed personalities can be queried in the ToolsAPI through the IOTAPersonalityServices interface.

Topics

See Also