public File performOpen(final Component parent,
final String title,
final FilesystemFilter[] rawFilter)
{
final FilterKey key = new FilterKey(rawFilter);
final JFileChooser fileChooser = new JFileChooser();
final FilesystemFilter[] filters = key.getFilters();
for (int i = 0; i < filters.length; i++)
{
final FilesystemFilter filesystemFilter = filters[i];
fileChooser.addChoosableFileFilter(filesystemFilter);
}
final File o = (File) instances.get(key);
if (o != null)
{
final File parentDir = o.getParentFile();
if (parentDir != null)
{
fileChooser.setCurrentDirectory(parentDir);
}
}
final int result = fileChooser.showOpenDialog(parent);
if (result == JFileChooser.APPROVE_OPTION)
{
final File resultFile = fileChooser.getSelectedFile();
instances.put(key, resultFile);
return resultFile;
}
return null;