Jump to content
Attila Kovacs

OTA Ide Shutdown

Recommended Posts

Is there a way to figure out that the IDE is going to shut down? Possibly before TOTAFileNotification fires.

Edited by Attila Kovacs

Share this post


Link to post

For what purpose? That may define exactly what the add-in should "look for". One way might be to use a timer to monitor the Visible property of the main form. As far as I know, the only time it becomes invisible is when the IDE is shutting down

Edited by Dave Nottage

Share this post


Link to post

@Dave Nottage I want to suppress some editor related dialogs in my plugon on closing the IDE, but I think I've found a way: TOTAFileNotification yields "projectname.$$$" file is going to be closed at first. Not sure what it is, temp file or what, but it seems always to be the first file to close.

 

It's the .groupproj file instead. Also fine I think. 

Edited by Attila Kovacs

Share this post


Link to post

@David Hoyle 

 

Quote

18.7 DockFormRefresh
procedure TEditorNotifier.DockFormRefresh(const EditWindow: INTAEditWindow;
DockForm: TDockableForm);
This method seems to be fired when the IDE is closing down and the desktop of being save. I've not
been able to get the event to fire for any other situations. The EditWindow is the edit window that
the docking operation is be docked to (it's a dock site) and DockForm is the form that is being docked.

 

I'm also getting this event every time I'm closing a file with ctrl-F4. Berlin U2.

 

 

Share this post


Link to post

The issue will be the timing of the events. Your main wizard will get destroyed at some point but I assume you are looking for the time period between File | Exit, etc and shutdown. I've not got an IDE available but you could install my notifier plug-in (https://github.com/DGH2112/DGH-IDE-Notifiers) (experimental) and switch on all notifiers and then close down the IDE then examine the log file to see what happens.

  • Like 1

Share this post


Link to post

@David Hoyle Thx, I was looking everywhere for this notifier!

 

For now I've switched to TOTAFileNotification, and I'm silent between

ofnProjectDesktopSave/ofnActiveProjectChanged  and the ofnFileClosing with the filename ending with '.dproj'.

 

Yeah, ugly botching, but I have no other choice at the moment...

Share this post


Link to post

@Attila Kovacs Another non-OTA solution might be to try hooking either the IDE's main form CloseQuery event or similar (you will probably need to chain an existing event and restore that event when you plug-in closes) or the events of the TApplication object.

Share this post


Link to post
3 hours ago, David Hoyle said:

@Attila Kovacs Another non-OTA solution might be to try hooking either the IDE's main form CloseQuery event or similar (you will probably need to chain an existing event and restore that event when you plug-in closes) or the events of the TApplication object.

Rather than hooking an event, which might already be hooked, you can create a custom TComponent descendant and set the main window as its parent. The main window will then destroy that component before it gets freed and you can intercept that to do whatever you need.

 

Regarding chaining events, see here for my suggestion to play fair with other plugins.

Share this post


Link to post
5 hours ago, Attila Kovacs said:

I didn't even look how could I access the main form

Application.MainForm, oddly enough

 

On 2/12/2019 at 8:32 PM, Attila Kovacs said:

I want to suppress some editor related dialogs in my plugin on closing the IDE

Not really enough to go on - why do they need to be suppressed? i.e. why would they even show at the point when the IDE is shutting down?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×