Login  Register

Re: Removing NonBlockingGenericDialogs from the Window menu

Posted by dscho on Mar 05, 2014; 1:35pm
URL: http://imagej.273.s1.nabble.com/Removing-NonBlockingGenericDialogs-from-the-Window-menu-tp5006758p5006782.html

Dear Wayne,

On Wed, 5 Mar 2014, Rasband, Wayne (NIH/NIMH) [E] wrote:

> On Mar 3, 2014, at 5:11 PM, Johannes Schindelin wrote:
>
> > While looking at the larger context, I also could not help but notice
> > that the dialog is added to the Window menu long before the dialog is
> > shown.  And indeed, it is added to the Window menu even if the dialog
> > is not shown at all (for which there are quite a few use cases -- I
> > trust your imagination to come up with even more than I could think
> > of).
>
> I moved "WindowManager.addWindow(this)" from the constructor to the
> showDialog() method, which should help.

Thank you.

> > A better practice would be to implement something like this (sorry, I
> > have no time to test this, besides, you made clear that you like to
> > implement such changes yourself and ignore pull requests, therefore I
> > will not burden you with one):
> >
> > @Override
> > public void setVisible(boolean visible) {
> > if (!visible) {
> > WindowManager.removeWindow(this);
> > }
> > super.setVisible(visible);
> > if (visible) {
> > WindowManager.addWindow(this);
> > }
> > }
>
> I could not get this to work. The setVisible() method is not called when
> the user closes the dialog.

My point was not to have this particular method removing the window from
the WindowManager. My point was to have a method that is always called
when the window closes do that. I guess dispose() would be called in that
case.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html