+ public Boolean check_overwrite(File in_file) {
+ final Semaphore check_overwrite_done = new Semaphore(0);
+ final File file = in_file;
+ final result_holder result = new result_holder();
+
+ Runnable r = new Runnable() {
+ public void run() {
+ result_holder.result = JOptionPane.showConfirmDialog(owner,
+ String.format("\"%s\" already exists, overwrite?",
+ file.toString()),
+ "Overwrite Existing File?",
+ JOptionPane.YES_NO_OPTION);
+ check_overwrite_done.release();
+ }
+ };
+
+ SwingUtilities.invokeLater(r);
+ try {
+ check_overwrite_done.acquire();
+ } catch (Exception e) {}
+ return result_holder.result == JOptionPane.YES_OPTION;
+ }
+