OTA experts, please help!

OTA experts, please help!

Is there a way to hook into 'buffer saved' event in a Delphi expert? Specifically, I would like to know when a contents of some editor tab were save to disk (and into which file).

Comments

  1. I'm pretty sure there is an interface that allows this, but I currently can't look it up. Will do when I get back to a computer.

    ReplyDelete
  2. type
    TGxModuleNotifier = class(TInterfacedObject, IOTANotifier,
    IOTAModuleNotifier, IGxModuleNotifier,
    IGxNotifierUninstallation)
    private
    FIdeClient: TGxIdeNotifier;
    private
    FSelfNotifierIndex: Integer;
    procedure RemoveSelfNotifier;
    private
    FCachedSourceEditors: array of IOTASourceEditor;
    // Note that this list of editor notifiers contains both
    // IOTAEditorNotifier and IOTAFormNotifier interface instances.
    FInstalledEditorNotifiers: TInterfaceList;
    private
    FAssociatedModule: IOTAModule;
    FFileName: string;
    procedure InstallEditorNotifiers;
    procedure RemoveEditorNotifiers;
    procedure RemoveSelfFromClient;
    protected
    // IOTANotifier - just there for playing
    procedure AfterSave;
    procedure BeforeSave;
    procedure Destroyed;
    procedure Modified;
    // IOTAModuleNotifier
    function CheckOverwrite: Boolean;
    procedure ModuleRenamed(const NewName: string);
    // IGxModuleNotifier
    function GetAssociatedModule: IOTAModule;
    // IGxNotifierUninstallation
    procedure UninstallNotifier;
    public
    constructor Create(AssociatedModule: IOTAModule; Client: TGxIdeNotifier);
    destructor Destroy; override;
    end;

    BeforeSave/AfterSave will be executed before and After Saving. You can find it in the GX_EditorChangeServices.

    ReplyDelete
  3. IOTAEditBuffer inherits from IOTAEditor, which has a property Module of type IOTAModule where you get the FIleName. When you register an IOTAModuleNotifier for that module you get an AfterSave event.

    ReplyDelete
  4. Ahhhhh, Module notifier. And I was trying to make AfterSave work at Editor notifier level.

    Thank you Roland Wind and Uwe Raabe!

    ReplyDelete
  5. Hmmmm, I'm still missing something. Who will tell me when an editor is created/destroyed so I can register/unregister the module notifier?

    ReplyDelete
  6. Is that IOTAIDENotifier.FileNotification? Or is there something easier to use?

    ReplyDelete
  7. INTAEditServicesNotifier.EditorViewActivated

    ReplyDelete
  8. Destruction is directly signaled to the notifier itself: IOTANotifier.Destroyed

    ReplyDelete
  9. OK, I guess I don't need to look it up now. ;-)

    ReplyDelete

Post a Comment