Listen for "IDEA is closing" event and terminate some processes
our IDEA-based application starts some external processes (an external JVM with debugger, specifically).
then I get "process... is running. disconnect from the process?" when I'm trying to close IDEA.
how can I add a listener for "IDEA is closing" event so that I can correctly terminate our external process?
Please sign in to leave a comment.
Hello Alexey,
You can use ProjectManagerListener.canCloseProject() method to shut down
your processes.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
unfortunately, I see both projectClosing() and canCloseProject() methods are only invoked AFTER "Process ... is running" dialog is shown and closed (see the screenshot). the goal is to avoid showing that dialog to user.
Attachment(s):
process_running.PNG
I guess I need to add the project listener at some earlier stage of the application startup...
ok, I added the project listener registration to the beginning of my method, which creates the tool window. this solves the problem. now canCloseProject() is called before that IDEA dialog can be shown, so I can properly terminate the debug process.
Hello Alexey,
This depends on the order of listeners registration.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"