I’m working on a plugin. The plugin executes external tools and I have to provide a confirm dialog, if the user tries to exit Eclipse, when a process is running yet. There are running processes. Do you really want to exit? If the user clicks No, the Eclipse may not terminate.
I’ve just found, how to hook the exit command to clean thinks up. (The plugin’s activator has the stop() method.) But the Eclipse will always terminate inevitably.
One colleague helped me to solve the problem. The solution is actually easy. All I need is a worgbench listener registered in activator. The listener has two methods for events pre- and postshutdown. The first one returns boolean. If it has returned true, the Eclipse exits. Otherwise the exit procedure is interrupted and the user can continue in his work.
In activator class:
The code of class
WBListener:That’s all.