/**
* Display a file save dialog
* @param extension The file extension of the destination file
*/
public static File showSaveFileDialog(Widget parent, String extension) {
JFileChooser chooser = new JFileChooser();
chooser.setFileFilter(new ExtensionFilter(extension, true));
if (chooser.showSaveDialog(parent.getRealWidget()) == JFileChooser.APPROVE_OPTION) {
String path = chooser.getSelectedFile().getPath();
if (!path.endsWith("." + extension))
path = path + "." + extension;
return new File(path);
} else {
return null;