@Override public void beforePage() { setTitle(extractor.getLabel()); // clear all entries (if embedded into multi-page wizard) allEntries.clear(); tableViewer.setInput(allEntries); errorTableViewer.setInput(Collections.emptyList()); try { new AbstractClientJob(client, extractor.getLabel()) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask(Messages.PDFImportWizardMsgExtracting, files.size()); final List<Exception> errors = new ArrayList<Exception>(); List<ExtractedEntry> entries = extractor // .extract(files, errors) .stream() // .map(i -> new ExtractedEntry(i)) // .collect(Collectors.toList()); // Logging them is not a bad idea if the whole method fails PortfolioPlugin.log(errors); Display.getDefault().asyncExec(() -> setResults(entries, errors)); return Status.OK_STATUS; } }.schedule(); } catch (Exception e) { throw new UnsupportedOperationException(e); } }
@Override public void afterPage() { preferences.setValue( IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName(), getAccount().getUUID()); preferences.setValue( IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName(), getPortfolio().getUUID()); }
private void preselectDropDowns() { // idea: generally one type of document (i.e. from the same bank) will // be imported into the same account List<Account> activeAccounts = client.getActiveAccounts(); if (!activeAccounts.isEmpty()) { String uuid = preferences.getString(IMPORT_TARGET_ACCOUNT + extractor.getClass().getSimpleName()); // do not trigger selection listener (-> do not user #setSelection) primaryAccount .getCombo() .select( IntStream.range(0, activeAccounts.size()) .filter(i -> activeAccounts.get(i).getUUID().equals(uuid)) .findAny() .orElse(0)); secondaryAccount.getCombo().select(0); } List<Portfolio> activePortfolios = client.getActivePortfolios(); if (!activePortfolios.isEmpty()) { String uuid = preferences.getString(IMPORT_TARGET_PORTFOLIO + extractor.getClass().getSimpleName()); // do not trigger selection listener (-> do not user #setSelection) primaryPortfolio .getCombo() .select( IntStream.range(0, activePortfolios.size()) .filter(i -> activePortfolios.get(i).getUUID().equals(uuid)) .findAny() .orElse(0)); secondaryPortfolio.getCombo().select(0); } }
public ReviewExtractedItemsPage( Client client, Extractor extractor, IPreferenceStore preferences, List<File> files) { super(PAGE_ID); this.client = client; this.extractor = extractor; this.preferences = preferences; this.files = files; setTitle(extractor.getLabel()); setDescription(Messages.PDFImportWizardDescription); }