use of name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction in project portfolio by buchen.
the class SecuritiesTable method fillTransactionContextMenu.
private void fillTransactionContextMenu(IMenuManager manager, Security security) {
// $NON-NLS-1$
new OpenDialogAction(view, Messages.SecurityMenuBuy + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.BUY).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(view, Messages.SecurityMenuSell + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.SELL).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(view, Messages.SecurityMenuDividends + "...").type(//
AccountTransactionDialog.class).parameters(//
AccountTransaction.Type.DIVIDENDS).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(view, AccountTransaction.Type.TAX_REFUND + "...").type(//
AccountTransactionDialog.class).parameters(//
AccountTransaction.Type.TAX_REFUND).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
manager.add(new AbstractDialogAction(Messages.SecurityMenuStockSplit) {
@Override
Dialog createDialog(Security security) {
StockSplitWizard wizard = new StockSplitWizard(getClient(), security);
return new WizardDialog(getShell(), wizard);
}
});
if (view.getClient().getActivePortfolios().size() > 1) {
manager.add(new Separator());
//
new OpenDialogAction(view, Messages.SecurityMenuTransfer).type(//
SecurityTransferDialog.class).with(//
security).addTo(manager);
}
manager.add(new Separator());
// $NON-NLS-1$
new OpenDialogAction(view, PortfolioTransaction.Type.DELIVERY_INBOUND.toString() + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.DELIVERY_INBOUND).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(view, PortfolioTransaction.Type.DELIVERY_OUTBOUND.toString() + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.DELIVERY_OUTBOUND).with(//
security).onSuccess(//
d -> performFinish(security)).addTo(manager);
manager.add(new Separator());
}
use of name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction in project portfolio by buchen.
the class InvestmentPlanListView method fillPlansContextMenu.
private void fillPlansContextMenu(IMenuManager manager) {
final InvestmentPlan plan = (InvestmentPlan) ((IStructuredSelection) plans.getSelection()).getFirstElement();
if (plan == null)
return;
manager.add(new Action(Messages.InvestmentPlanMenuGenerateTransactions) {
@Override
public void run() {
CurrencyConverterImpl converter = new CurrencyConverterImpl(factory, getClient().getBaseCurrency());
List<PortfolioTransaction> latest = plan.generateTransactions(converter);
if (latest.isEmpty()) {
MessageDialog.openInformation(getActiveShell(), Messages.LabelInfo, MessageFormat.format(Messages.InvestmentPlanInfoNoTransactionsGenerated, Values.Date.format(plan.getDateOfNextTransactionToBeGenerated())));
} else {
markDirty();
plans.refresh();
transactions.markTransactions(latest);
transactions.setInput(plan.getPortfolio(), plan.getTransactions());
}
}
});
manager.add(new Separator());
//
new OpenDialogAction(this, Messages.MenuEditInvestmentPlan).type(InvestmentPlanDialog.class, //
d -> d.setPlan(plan)).onSuccess(d -> {
markDirty();
plans.setInput(getClient().getPlans());
}).addTo(manager);
manager.add(new Action(Messages.InvestmentPlanMenuDelete) {
@Override
public void run() {
getClient().removePlan(plan);
markDirty();
plans.setInput(getClient().getPlans());
transactions.setInput(null, null);
}
});
}
use of name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction in project portfolio by buchen.
the class AccountContextMenu method menuAboutToShow.
public void menuAboutToShow(IMenuManager manager, final Account account, final Security security) {
if (account == null)
return;
for (final AccountTransaction.Type type : //
EnumSet.of(//
AccountTransaction.Type.DEPOSIT, //
AccountTransaction.Type.REMOVAL, //
AccountTransaction.Type.TAXES, //
AccountTransaction.Type.TAX_REFUND, //
AccountTransaction.Type.FEES, //
AccountTransaction.Type.FEES_REFUND, //
AccountTransaction.Type.INTEREST, AccountTransaction.Type.INTEREST_CHARGE)) {
// $NON-NLS-1$
new OpenDialogAction(owner, type.toString() + "...").type(//
AccountTransactionDialog.class).parameters(//
type).with(//
account).with(//
security).addTo(manager);
}
manager.add(new Separator());
//
new OpenDialogAction(owner, Messages.AccountMenuTransfer).type(//
AccountTransferDialog.class).with(//
account).addTo(manager);
manager.add(new Separator());
if (!owner.getClient().getActivePortfolios().isEmpty() && !owner.getClient().getSecurities().isEmpty()) {
// preselect a portfolio that has the current
// account as a reference account
final Portfolio[] portfolio = new Portfolio[1];
for (Portfolio p : owner.getClient().getActivePortfolios()) {
if (p.getReferenceAccount().equals(account)) {
portfolio[0] = p;
break;
}
}
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuBuy + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.BUY).with(//
portfolio[0]).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuSell + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.SELL).with(//
portfolio[0]).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuDividends + "...").type(//
AccountTransactionDialog.class).parameters(//
AccountTransaction.Type.DIVIDENDS).with(//
account).with(//
security).addTo(manager);
}
}
use of name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction in project portfolio by buchen.
the class SecurityContextMenu method menuAboutToShow.
public void menuAboutToShow(IMenuManager manager, final Security security, final Portfolio portfolio) {
if (owner.getClient().getSecurities().isEmpty())
return;
// menus to create transactions
if (security != null && security.getCurrencyCode() == null) {
manager.add(new BookmarkMenu(owner.getPart(), security));
return;
}
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuBuy + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.BUY).with(//
portfolio).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuSell + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.SELL).with(//
portfolio).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, Messages.SecurityMenuDividends + "...").type(//
AccountTransactionDialog.class).parameters(//
AccountTransaction.Type.DIVIDENDS).with(//
portfolio != null ? portfolio.getReferenceAccount() : null).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, AccountTransaction.Type.TAX_REFUND + "...").type(//
AccountTransactionDialog.class).parameters(//
AccountTransaction.Type.TAX_REFUND).with(//
portfolio != null ? portfolio.getReferenceAccount() : null).with(//
security).addTo(manager);
manager.add(new Action(Messages.SecurityMenuStockSplit) {
@Override
public void run() {
StockSplitWizard wizard = new StockSplitWizard(owner.getClient(), security);
WizardDialog dialog = new WizardDialog(owner.getActiveShell(), wizard);
if (dialog.open() == Dialog.OK) {
owner.markDirty();
owner.notifyModelUpdated();
}
}
});
if (owner.getClient().getActivePortfolios().size() > 1) {
manager.add(new Separator());
//
new OpenDialogAction(owner, Messages.SecurityMenuTransfer).type(//
SecurityTransferDialog.class).with(//
portfolio).with(//
security).addTo(manager);
}
manager.add(new Separator());
// $NON-NLS-1$
new OpenDialogAction(owner, PortfolioTransaction.Type.DELIVERY_INBOUND.toString() + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.DELIVERY_INBOUND).with(//
portfolio).with(//
security).addTo(manager);
// $NON-NLS-1$
new OpenDialogAction(owner, PortfolioTransaction.Type.DELIVERY_OUTBOUND.toString() + "...").type(//
SecurityTransactionDialog.class).parameters(//
PortfolioTransaction.Type.DELIVERY_OUTBOUND).with(//
portfolio).with(//
security).addTo(manager);
if (security != null) {
manager.add(new Separator());
manager.add(new BookmarkMenu(owner.getPart(), security));
}
}
use of name.abuchen.portfolio.ui.dialogs.transactions.OpenDialogAction in project portfolio by buchen.
the class InvestmentPlanListView method addNewInvestmentPlanButton.
private void addNewInvestmentPlanButton(ToolBar toolBar) {
Action action = //
new OpenDialogAction(this, Messages.InvestmentPlanMenuCreate).type(InvestmentPlanDialog.class).onSuccess(d -> {
markDirty();
plans.setInput(getClient().getPlans());
});
action.setImageDescriptor(Images.PLUS.descriptor());
action.setToolTipText(Messages.InvestmentPlanMenuCreate);
new ActionContributionItem(action).fill(toolBar, -1);
}
Aggregations