Prevent imageJ exit


#1

Hi all,

I have a small question, we are developing an imageJ plugin which drive Restful APIs of an external app.
Some of the operations are really long to process so the plugin has to be kept alive until the operation end.

We managed to make a confirmation box at the exit of the plugin to prevent erroneous closing while the operation is pending.

The problem we met is that exit of Fiji/imageJ shutdown the running plugin without the warning message. So the user have no chance to cancel an erroneous exit of imageJ.

Is there a way to make our plugin stop the Fiji/imageJ closing process until the user confirm his exiting action (like the modified stack warning at Fiji exit) ?

Best regards

Salim


#2

Hi,

I think you could try to override this method :
public void windowClosing(WindowEvent e)
This method is called everytime the window is in the process of closing, so I believe it should work when the user closes ImageJ.


#3

Hello,

It seems that the code within public void windowClosing(WindowEvent e) is never taken into account when ImageJ is closing (currently, it works only when trying to close the plugin itself directly). It actually looks like ImageJ is exiting on close (like JFrame.EXIT_ON_CLOSE).