Re: Plugin Command To Close Window Without "Save Changes?" Dialog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Plugin Command To Close Window Without "Save Changes?" Dialog

Peter Haub
Hi Colin,

here is an example code:

//*************************************************

// This plugin closes all the image windows without saving
import ij.*;
import ij.plugin.PlugIn;

public class Window_Closer implements PlugIn {
     public void run(String arg) {
         ImagePlus img;
         while (null != WindowManager.getCurrentImage()) {
             img = WindowManager.getCurrentImage();
             img.changes = false;
             img.close();
         }
     }
}
//***********************************************

Regards,
Peter


On 30.08.2011 02:14, ColinWhite wrote:

> Hi,
>
> Is there a way to close an image window without being prompted with the
> "save changes?" dialog from within a plugin. Thanks for any replies.
>
> -Colin
>
> --
> View this message in context: http://imagej.588099.n2.nabble.com/Plugin-Command-To-Close-Window-Without-Save-Changes-Dialog-tp6740364p6740364.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Plugin Command To Close Window Without "Save Changes?" Dialog

ColinWhite
Thanks. That works great.


________________________________
From: Peter Haub <[hidden email]>
To: [hidden email]
Sent: Tuesday, August 30, 2011 2:40 AM
Subject: Re: Plugin Command To Close Window Without "Save Changes?" Dialog

Hi Colin,

here is an example code:

//*************************************************

// This plugin closes all the image windows without saving
import ij.*;
import ij.plugin.PlugIn;

public class Window_Closer implements PlugIn {
    public void run(String arg) {
        ImagePlus img;
        while (null != WindowManager.getCurrentImage()) {
            img = WindowManager.getCurrentImage();
            img.changes = false;
            img.close();
        }
    }
}
//***********************************************

Regards,
Peter


On 30.08.2011 02:14, ColinWhite wrote:

> Hi,
>
> Is there a way to close an image window without being prompted with the
> "save changes?" dialog from within a plugin. Thanks for any replies.
>
> -Colin
>
> --
> View this message in context: http://imagej.588099.n2.nabble.com/Plugin-Command-To-Close-Window-Without-Save-Changes-Dialog-tp6740364p6740364.html
> Sent from the ImageJ mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Plugin Command To Close Window Without "Save Changes?" Dialog

Citron, Bruce
In reply to this post by Peter Haub
Peter- Any chance that since you were so expert with Colin¹s question, that
you could solve my Need Macro command to Click OK in a window query?

How does one automatically do things like click an OK button in a window
generated by a called plugin, e.g., ShapeLogic, while running
an ImageJ Macro?

Thanks,
Bruce