import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
/**
* single thread that handles display of dialogs to user.
*/
- ExecutorService dialogExecutor=null;
+ ExecutorService dialogExecutor=Executors.newSingleThreadExecutor();
/**
* add another dialog thread to the queue
* @param prompter
*/
- public synchronized void addDialogThread(Runnable prompter)
+ public void addDialogThread(final Runnable prompter)
{
- if (dialogExecutor==null)
+ dialogExecutor.submit(new Runnable()
{
- dialogExecutor = Executors.newSingleThreadExecutor();
- }
- dialogExecutor.submit(prompter);
+ public void run()
+ {
+ try
+ {
+ SwingUtilities.invokeAndWait(prompter);
+ } catch (Exception q)
+ {
+ Cache.log.warn("Unexpected Exception in dialog thread.", q);
+ }
+ }
+ });
}
}
}
try
{
- int reply = JOptionPane.showInternalConfirmDialog(
- Desktop.desktop, // component,
+ int reply = JOptionPane.showConfirmDialog(
+ null, // component,
dialogText, dialogTitle,
(allowCancel) ? JOptionPane.YES_NO_CANCEL_OPTION
: JOptionPane.YES_NO_OPTION,