Search in sources :

Example 1 with PlugInFrame

use of ij.plugin.frame.PlugInFrame in project imagej1 by imagej.

the class WindowManager method closeAllWindows.

/**
 * Closes all windows. Stops and returns false if an image or Editor "save changes" dialog is canceled.
 */
public static synchronized boolean closeAllWindows() {
    Prefs.closingAll = true;
    while (imageList.size() > 0) {
        if (!((ImageWindow) imageList.get(0)).close()) {
            Prefs.closingAll = false;
            return false;
        }
        if (!quittingViaMacro())
            IJ.wait(100);
    }
    Prefs.closingAll = false;
    Frame[] nonImages = getNonImageWindows();
    for (int i = 0; i < nonImages.length; i++) {
        Frame frame = nonImages[i];
        if (frame != null && (frame instanceof Editor)) {
            ((Editor) frame).close();
            if (((Editor) frame).fileChanged())
                return false;
            if (!quittingViaMacro())
                IJ.wait(100);
        }
    }
    ImageJ ij = IJ.getInstance();
    if (ij != null && ij.quitting() && IJ.getApplet() == null)
        return true;
    for (int i = 0; i < nonImages.length; i++) {
        Frame frame = nonImages[i];
        if ((frame instanceof PlugInFrame) && !(frame instanceof Editor))
            ((PlugInFrame) frame).close();
        else if (frame instanceof TextWindow)
            ((TextWindow) frame).close();
        else {
            // frame.setVisible(false);
            frame.dispose();
        }
    }
    return true;
}
Also used : PlugInFrame(ij.plugin.frame.PlugInFrame) TextWindow(ij.text.TextWindow) PlugInFrame(ij.plugin.frame.PlugInFrame) Editor(ij.plugin.frame.Editor)

Aggregations

Editor (ij.plugin.frame.Editor)1 PlugInFrame (ij.plugin.frame.PlugInFrame)1 TextWindow (ij.text.TextWindow)1