OpenTools API は、コンパイルの前後に通知を受けるためのインターフェースを定義します。
IOTAIDENotifier = interface(IOTANotifier)
['{E052204F-ECE9-11D1-AB19-00C04FB16FB3}']
procedure FileNotification(NotifyCode: TOTAFileNotification; const FileName: string; var Cancel: Boolean); // This procedure is called for many various file operations within the IDE
procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean); overload; // This function is called immediatately before the compiler is invoked. Set Cancel to True to cancel the compile
procedure AfterCompile(Succeeded: Boolean); overload; // This procedure is called immediately following a compile. Succeeded will be true if the compile was successful
end;
このインターフェイスをエクスポートするウィザードを作成しました:
TDBGExportWizard = class(TNotifierObject, IOTANotifier, IOTAIDENotifier, IOTAIDENotifier50, IOTAWizard)
public
{ IOTANotifier }
// procedure AfterSave; //This procedure is called immediately after the item is successfully saved. This is not called for IOTAWizards
// procedure BeforeSave; //This function is called immediately before the item is saved. This is not called for IOTAWizard
// procedure Destroyed; // The associated item is being destroyed so all references should be dropped. Exceptions are ignored.
// procedure Modified; // This associated item was modified in some way. This is not called for IOTAWizards
{ IOTAIDENotifier }
procedure FileNotification(NotifyCode: TOTAFileNotification; const FileName: string; var Cancel: Boolean);
procedure BeforeCompile(const Project: IOTAProject; var Cancel: Boolean); overload;
procedure AfterCompile(Succeeded: Boolean); overload;
{ IOTAIDENotifier50 }
procedure BeforeCompile(const Project: IOTAProject; IsCodeInsight: Boolean; var Cancel: Boolean); overload;
procedure AfterCompile(Succeeded: Boolean; IsCodeInsight: Boolean); overload;
{ IOTAWizard }
function GetIDString: string;
function GetName: string;
function GetState: TWizardState;
procedure Execute;
end;
ウィザードを次のように登録します。
procedure Register;
begin
RegisterPackageWizard(TDBGExportWizard.Create);
end;
しかし、どちらも:
IOTAIDENotifier.BeforeCompile
IOTAIDENotifier.AfterCompile
IOTAIDENotifier.FileNotification
IOTAIDENotifier50.BeforeCompile
IOTAIDENotifier50.AfterCompile
呼ばれます。私は何を間違っていますか?
これまでに呼び出された唯一のものは
IOTAWizard.GetName
IOTAWizard.GetIDString
その順番で。