diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/TransactionContextMenu.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/TransactionContextMenu.java index 41ca75027c..b16ec73ef2 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/TransactionContextMenu.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/TransactionContextMenu.java @@ -82,6 +82,15 @@ public void handleEditKey(KeyEvent e, IStructuredSelection selection) tx.withAccountTransaction().ifPresent(t -> createEditAccountTransactionAction(t).run()); tx.withPortfolioTransaction().ifPresent(t -> createEditPortfolioTransactionAction(t).run()); } + if (e.keyCode == 'd' && e.stateMask == SWT.MOD1) + { + if (selection.isEmpty()) + return; + + TransactionPair tx = (TransactionPair) selection.getFirstElement(); + tx.withAccountTransaction().ifPresent(t -> createCopyAccountTransactionAction(t).run()); + tx.withPortfolioTransaction().ifPresent(t -> createCopyPortfolioTransactionAction(t).run()); + } } private void fillContextMenuPortfolioTxList(IMenuManager manager, IStructuredSelection selection) @@ -131,7 +140,9 @@ private void fillContextMenuAccountTx(IMenuManager manager, boolean fullContextM action.setAccelerator(SWT.MOD1 | 'E'); manager.add(action); - manager.add(createCopyAccountTransactionAction(tx)); + Action duplicateAction = createCopyAccountTransactionAction(tx); + duplicateAction.setAccelerator(SWT.MOD1 | 'D'); + manager.add(duplicateAction); if (fullContextMenu) { @@ -150,7 +161,9 @@ private void fillContextMenuPortfolioTx(IMenuManager manager, boolean fullContex editAction.setAccelerator(SWT.MOD1 | 'E'); manager.add(editAction); - manager.add(createCopyPortfolioTransactionAction(tx)); + Action duplicateAction = createCopyPortfolioTransactionAction(tx); + duplicateAction.setAccelerator(SWT.MOD1 | 'D'); + manager.add(duplicateAction); manager.add(new Separator()); diff --git a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/panes/AccountTransactionsPane.java b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/panes/AccountTransactionsPane.java index f8fbfda3e3..986a40ea46 100644 --- a/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/panes/AccountTransactionsPane.java +++ b/name.abuchen.portfolio.ui/src/name/abuchen/portfolio/ui/views/panes/AccountTransactionsPane.java @@ -523,6 +523,14 @@ public void keyPressed(KeyEvent e) if (account != null && transaction != null) createEditAction(account, transaction).run(); } + if (e.keyCode == 'd' && e.stateMask == SWT.MOD1) + { + AccountTransaction transaction = (AccountTransaction) ((IStructuredSelection) transactions + .getSelection()).getFirstElement(); + + if (account != null && transaction != null) + createCopyAction(account, transaction).run(); + } } }); } @@ -541,7 +549,9 @@ private void fillTransactionsContextMenu(IMenuManager manager) // NOSONAR action.setAccelerator(SWT.MOD1 | 'E'); manager.add(action); - manager.add(createCopyAction(account, transaction)); + Action duplicateAction = createCopyAction(account, transaction); + duplicateAction.setAccelerator(SWT.MOD1 | 'D'); + manager.add(duplicateAction); manager.add(new Separator()); }