use of name.abuchen.portfolio.ui.wizards.datatransfer.ImportExtractedItemsWizard in project portfolio by buchen.
the class ImportIBHandler method execute.
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) throws IOException {
Client client = MenuHelper.getActiveClient(part);
if (client == null)
return;
try {
Extractor extractor = new IBFlexStatementExtractor(client);
FileDialog fileDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
fileDialog.setText(extractor.getLabel());
fileDialog.setFilterNames(new String[] { // $NON-NLS-1$
MessageFormat.format("{0} ({1})", extractor.getLabel(), extractor.getFilterExtension()) });
fileDialog.setFilterExtensions(new String[] { extractor.getFilterExtension() });
fileDialog.open();
String[] filenames = fileDialog.getFileNames();
if (filenames.length == 0)
return;
List<Extractor.InputFile> files = new ArrayList<>();
for (String filename : filenames) files.add(new Extractor.InputFile(new File(fileDialog.getFilterPath(), filename)));
IPreferenceStore preferences = ((PortfolioPart) part.getObject()).getPreferenceStore();
Dialog wizwardDialog = new WizardDialog(Display.getDefault().getActiveShell(), new ImportExtractedItemsWizard(client, extractor, preferences, files));
wizwardDialog.open();
} catch (IllegalArgumentException e) {
PortfolioPlugin.log(e);
MessageDialog.openError(shell, Messages.LabelError, e.getMessage());
}
}
use of name.abuchen.portfolio.ui.wizards.datatransfer.ImportExtractedItemsWizard in project portfolio by buchen.
the class ImportPDFHandler method openWizard.
protected void openWizard(Shell shell, Client client, List<Extractor.InputFile> files, IPreferenceStore preferences, boolean isLegacyMode) {
try {
ImportExtractedItemsWizard wizard = new ImportExtractedItemsWizard(client, null, preferences, files);
wizard.setLegacyMode(isLegacyMode);
Dialog wizwardDialog = new WizardDialog(shell, wizard);
wizwardDialog.open();
} catch (IOException e) {
PortfolioPlugin.log(e);
MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.LabelError, e.getMessage());
}
}
Aggregations