use of name.abuchen.portfolio.datatransfer.IBFlexStatementExtractor 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());
}
}
Aggregations