Delphi IDE Expert - intercept "View Source" or DPR-file loading

523 views Asked by At

Trying to tune AutoOpenUnit IDE Expert (implementing I-OTA-IDE-Notifier and implementing FileNotification event) for my Delphi XE2 I stumbled upon a problem...

I need to scan every source file opened by Code Editor (or by IDE itself).

I made a test project: console app (DPR) which uses two units - Unit1.pas and Unit2.pas

I delete the project DSK file or save the project having no files opened in the Code Editor, or only the DPK file alone.

Now, the .DPR file itself is almost never passed do the notifier event. The only case when it happened - is when I do "Open Project" and specify it.

However when I do File/Reopen - it is DRPOJ-file signalled as opened, but not the DPR-file. When I restart the IDE with the project pre-opened, it again 'opens' the DPROJ file, 'skipping' the DPR-file.

There go notifications like Active Project changed. There even go "file opening" notifications for project DSK file and for default empty Project Group file. But not for the project source file.

Here I can come with a crude hack, to extract project name from the DPROJ-file and to "notify" myself. Though is it the fact, that IDE would not fire some "normal" event for it???

Yet worse. If I have the project opened (but the project DPR file closed), and then I do the View Source action - then while Code Editor opens the new tab for the project still there is no ANY event coming to the expert.

Is there a way to surely get notified by the IDE when the new tab with the project root file is being opened in the Code Editor?

UPD. I found iOTAEditorNotifier, now trying to read CnWizards how they manage to utilize it, as there seems to be no registering calls for that interface in IDE OTA...

P.S. https://github.com/the-Arioch/XE2_AutoOpenUnit

P.P.S. the XE2 string double-free bug demo: http://www.sql.ru/forum/1300873-a/xe2-string-double-free

0

There are 0 answers