Search in sources :

Example 1 with ConsistencyChecksJob

use of name.abuchen.portfolio.ui.ConsistencyChecksJob in project portfolio by buchen.

the class CSVImportWizard method performFinish.

@Override
public boolean performFinish() {
    ((AbstractWizardPage) getContainer().getCurrentPage()).afterPage();
    boolean isDirty = false;
    if (importer.getExtractor() == importer.getSecurityPriceExtractor())
        isDirty = importSecurityPrices();
    else
        isDirty = importItems();
    if (isDirty) {
        client.markDirty();
        new ConsistencyChecksJob(client, false).schedule();
    }
    return true;
}
Also used : ConsistencyChecksJob(name.abuchen.portfolio.ui.ConsistencyChecksJob) AbstractWizardPage(name.abuchen.portfolio.ui.wizards.AbstractWizardPage)

Example 2 with ConsistencyChecksJob

use of name.abuchen.portfolio.ui.ConsistencyChecksJob in project portfolio by buchen.

the class ImportExtractedItemsWizard method performFinish.

@Override
public boolean performFinish() {
    if (!pages.isEmpty()) {
        boolean isDirty = false;
        for (int index = 0; index < pages.size(); index++) {
            ReviewExtractedItemsPage page = pages.get(index);
            page.afterPage();
            InsertAction action = new InsertAction(client);
            action.setConvertBuySellToDelivery(page.doConvertToDelivery());
            for (ExtractedEntry entry : page.getEntries()) {
                if (entry.isImported()) {
                    entry.getItem().apply(action, page);
                    isDirty = true;
                }
            }
        }
        if (isDirty) {
            client.markDirty();
            // run consistency checks in case bogus transactions have been
            // created (say: an outbound delivery of a security where there
            // no held shares)
            new ConsistencyChecksJob(client, false).schedule();
        }
    }
    return true;
}
Also used : ConsistencyChecksJob(name.abuchen.portfolio.ui.ConsistencyChecksJob) InsertAction(name.abuchen.portfolio.datatransfer.actions.InsertAction)

Example 3 with ConsistencyChecksJob

use of name.abuchen.portfolio.ui.ConsistencyChecksJob in project portfolio by buchen.

the class RunConsistencyChecksHandler method execute.

@Execute
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell) {
    Client client = MenuHelper.getActiveClient(part);
    if (client == null)
        return;
    new ConsistencyChecksJob(client, true).schedule();
}
Also used : ConsistencyChecksJob(name.abuchen.portfolio.ui.ConsistencyChecksJob) Client(name.abuchen.portfolio.model.Client) CanExecute(org.eclipse.e4.core.di.annotations.CanExecute) Execute(org.eclipse.e4.core.di.annotations.Execute)

Aggregations

ConsistencyChecksJob (name.abuchen.portfolio.ui.ConsistencyChecksJob)3 InsertAction (name.abuchen.portfolio.datatransfer.actions.InsertAction)1 Client (name.abuchen.portfolio.model.Client)1 AbstractWizardPage (name.abuchen.portfolio.ui.wizards.AbstractWizardPage)1 CanExecute (org.eclipse.e4.core.di.annotations.CanExecute)1 Execute (org.eclipse.e4.core.di.annotations.Execute)1