OTA - Understanding BorlandIDEServices

A package can access the IDE through the global interface defined in ToolsApi.pas:

  BorlandIDEServices: IBorlandIDEServices;

  Through this interface you may query any of the other OTA Service inteface defined in ToolsApi.pas.

  To create our new project we will need the IOTAModuleServices.

  IOTAModuleServices = interface(IUnknown)
  ['{F17A7BCD-E07D-11D1-AB0B-00C04FB16FB3}']
  function AddFileSystem(FileSystem: IOTAFileSystem): Integer;
  function CloseAll: Boolean;
  function CreateModule(const Creator: IOTACreator): IOTAModule;
  function CurrentModule: IOTAModule;
  function FindFileSystem(const Name: string): IOTAFileSystem;
  function FindFormModule(const FormName: string): IOTAModule;
  function FindModule(const FileName: string): IOTAModule;
  function GetModuleCount: Integer;
  function GetModule(Index: Integer): IOTAModule;
  procedure GetNewModuleAndClassName(const Prefix: string; var UnitIdent, ClassName, FileName: string);
  function NewModule: Boolean;
  procedure RemoveFileSystem(Index: Integer);
  function SaveAll: Boolean;

  property ModuleCount: Integer read GetModuleCount;
  property Modules[Index: Integer]: IOTAModule read GetModule;
  end;

  We query the BorlandIDEServices interface for the Module Services like so:

procedure TProjectCreatorWizard.Execute;
//
// Called when the Wizard is Selected in the ObjectRepository
//
var
  ModuleServices: IOTAModuleServices;
begin
  ModuleServices := (BorlandIDEServices as IOTAModuleServices)
end;

  Once we have the Module Services interface we can Create Modules, Close Modules, Enumerate Open Modules and receive each Module's interface.

 

  The next step in creating a new Project Module is to understand Modules and Editors.

 


mustangpeak.net

  Last Modified on: