use of name.abuchen.portfolio.ui.AbstractClientJob in project portfolio by buchen.
the class ReviewExtractedItemsPage method runExtractionJob.
private void runExtractionJob() {
allEntries.clear();
tableViewer.setInput(allEntries);
errorTableViewer.setInput(Collections.emptyList());
Extractor selectedExtractor = extractor instanceof AssistantPDFExtractor ? getPDFBankExtractor() : extractor;
if (selectedExtractor == null) {
setResults(Collections.emptyList(), files.stream().map(f -> new UnsupportedOperationException(f.getName())).collect(Collectors.toList()));
return;
}
try {
new AbstractClientJob(client, extractor.getLabel()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(Messages.PDFImportWizardMsgExtracting, files.size());
final List<Exception> errors = new ArrayList<>();
try {
List<ExtractedEntry> entries = //
selectedExtractor.extract(files, errors).stream().map(//
ExtractedEntry::new).collect(Collectors.toList());
// Logging them is not a bad idea if the whole method
// fails
PortfolioPlugin.log(errors);
Display.getDefault().asyncExec(() -> setResults(entries, errors));
} catch (Exception e) {
throw new UnsupportedOperationException(e);
}
return Status.OK_STATUS;
}
}.schedule();
} catch (Exception e) {
throw new UnsupportedOperationException(e);
}
}
Aggregations