package ij.gui;
import ij.*;
import java.awt.event.*;
import java.awt.EventQueue;
public class NonBlockingGenericDialog extends GenericDialog {
public NonBlockingGenericDialog(String title) {
super(title, null);
setModal(false);
}
public synchronized void showDialog() {
super.showDialog();
if (isMacro())
return;
if (!IJ.macroRunning()) { final NonBlockingGenericDialog thisDialog = this;
EventQueue.invokeLater(new Runnable() {
public void run() {
WindowManager.addWindow(thisDialog);
}
});
}
try {
wait();
} catch (InterruptedException e) { }
}
public synchronized void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
if (!isVisible())
notify();
}
public synchronized void keyPressed(KeyEvent e) {
super.keyPressed(e);
if (wasOKed() || wasCanceled())
notify();
}
public synchronized void windowClosing(WindowEvent e) {
super.windowClosing(e);
if (wasOKed() || wasCanceled())
notify();
}
public void dispose() {
super.dispose();
WindowManager.removeWindow(this);
}
}