chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setDialogTitle("Choose directory or file");
chooser.setFileView(new FileIcon(MapFrame.This()));
// filter file
String extension[] = {"tdb"};
chooser.addChoosableFileFilter(new SimpleFileFilter(extension, "Directory or .tdb"));
// display file chooser
int option = chooser.showOpenDialog(null);
if (option == JFileChooser.APPROVE_OPTION) {
// file/folder was chosen. Run batch query
WorkerFolderBatch worker = new WorkerFolderBatch(chooser.getSelectedFile(), getBatchAreaQueryLength());