Browse Source

Bugfix: Solves HEADLESS crash on Macs.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@1349 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 17 years ago
parent
commit
e3f6726150
  1. 30
      prism/src/settings/FileSetting.java

30
prism/src/settings/FileSetting.java

@ -46,19 +46,27 @@ public class FileSetting extends Setting
private static FileSelector defaultSelector()
{
return new FileSelector()
{
JFileChooser choose = new JFileChooser();
public File getFile(Frame parent, File defaultFile)
try {
return new FileSelector()
{
choose.setSelectedFile(defaultFile);
int choice = choose.showOpenDialog(parent);
if(choice == JFileChooser.CANCEL_OPTION) return null;
else return choose.getSelectedFile();
JFileChooser choose = new JFileChooser();
}
};
public File getFile(Frame parent, File defaultFile)
{
choose.setSelectedFile(defaultFile);
int choice = choose.showOpenDialog(parent);
if(choice == JFileChooser.CANCEL_OPTION) return null;
else return choose.getSelectedFile();
}
};
}
// Catch any problems that occur when running in headless mode
// (e.g. the command-line version of PRISM)
// (in this case, you don't need this object anyway)
catch (HeadlessException e) {
return null;
}
}
private boolean validFile;

Loading…
Cancel
Save