use of name.abuchen.portfolio.ui.wizards.splits.StockSplitWizard 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.wizards.splits.StockSplitWizard 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));
}
}
Aggregations