package name.abuchen.portfolio.ui.views.actions;

import org.eclipse.jface.action.Action;

import name.abuchen.portfolio.model.AccountTransaction;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.TransactionPair;

public class ConvertToDepositRemovalAction extends Action
{
    private final Client client;
    private final TransactionPair<AccountTransaction> transaction;

    public ConvertToDepositRemovalAction(Client client, TransactionPair<AccountTransaction> transaction)
    {
        this.client = client;
        this.transaction = transaction;

        if (transaction.getTransaction().getType() != AccountTransaction.Type.DEPOSIT
                        && transaction.getTransaction().getType() != AccountTransaction.Type.FEES
                        && transaction.getTransaction().getType() != AccountTransaction.Type.FEES_REFUND
                        && transaction.getTransaction().getType() != AccountTransaction.Type.INTEREST
                        && transaction.getTransaction().getType() != AccountTransaction.Type.INTEREST_CHARGE
                        && transaction.getTransaction().getType() != AccountTransaction.Type.REMOVAL
                        && transaction.getTransaction().getType() != AccountTransaction.Type.TAXES
                        && transaction.getTransaction().getType() != AccountTransaction.Type.TAX_REFUND
                        )
            throw new IllegalArgumentException();
    }

    @Override
    public void run()
    {
        AccountTransaction accountTransaction = transaction.getTransaction();

        if (AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType())
                        || AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType())
                        || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType())
                        || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType()))
            accountTransaction.setType(AccountTransaction.Type.DEPOSIT);
        else if (AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType())
                        || AccountTransaction.Type.FEES.equals(accountTransaction.getType())
                        || AccountTransaction.Type.TAXES.equals(accountTransaction.getType())
                        || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType()))
            accountTransaction.setType(AccountTransaction.Type.REMOVAL);
        else
            throw new IllegalArgumentException();

        client.markDirty();
    }
}

@@ -1605,104 +1605,8 @@
 if (
-AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType())%0A                        %7C%7C 
 Acco
@@ -1965,104 +1965,8 @@
 if (
-AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType())%0A                        %7C%7C 
 Acco

Update ConvertToDepositRemovalAction.java