}
// Initialize the ImageList data for the browser from the given directory
// under a ProgressDialog.
private void initImages(final File directory, final boolean useCache) {
ProgressDialog dialog = Platform.getPlatform().getProgressDialog();
ProgressThread thread = new ProgressThread(dialog) {
public void run() {
DocumentDatabase.addDocumentDirectory(directory);
images = new ImageList(
directory,
100,
FileCacheFactory.get(directory),
useCache,
ImageDatumComparator.CaptureTime,
getProgressIndicator()
);
}
public void cancel() {
ImageList.cancel();
}
};
FileSystemView view = Platform.getPlatform().getFileSystemView();
String dirName = view.getSystemDisplayName(directory);
dialog.showProgress(
this, thread, LOCALE.get("ScanningMessage", dirName), 0, 1, true
);
Throwable t = dialog.getThrown();
if (t != null) {
throw new RuntimeException(LOCALE.get("ScanningError"), t);
}
if (images.getAllImageData().isEmpty()) {
// Enqueue this, because the layout may be getting initialized