Merge lp:~tapaal-contributor/tapaal/shortcut-undo-1941839 into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1150
Merged at revision: 1150
Proposed branch: lp:~tapaal-contributor/tapaal/shortcut-undo-1941839
Merge into: lp:tapaal
Diff against target: 38 lines (+22/-1)
1 file modified
src/pipe/gui/widgets/QueryDialog.java (+22/-1)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/shortcut-undo-1941839
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+409591@code.launchpad.net

Commit message

Added shortcuts for undo and redo in query dialog

Description of the change

When pressing ctrl+z in the query dialog the last change will be undone
When pressing ctrl+y the it will be redone

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Tested and works

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/widgets/QueryDialog.java'
2--- src/pipe/gui/widgets/QueryDialog.java 2021-09-29 09:36:24 +0000
3+++ src/pipe/gui/widgets/QueryDialog.java 2021-10-04 17:37:22 +0000
4@@ -339,7 +339,8 @@
5 setLayout(new GridBagLayout());
6
7 init(option, queryToCreateFrom);
8- toggleAdvancedSimpleView(false);
9+ makeShortcuts();
10+ toggleAdvancedSimpleView(false);
11 }
12
13 private boolean checkIfSomeReductionOption() {
14@@ -3348,4 +3349,24 @@
15
16 }
17
18+ private void makeShortcuts(){
19+ int shortcutkey = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
20+ ActionMap am = this.getActionMap();
21+ am.put("undo", new AbstractAction() {
22+ @Override
23+ public void actionPerformed(ActionEvent e) {
24+ undoButton.doClick();
25+ }
26+ });
27+ am.put("redo", new AbstractAction() {
28+ @Override
29+ public void actionPerformed(ActionEvent e) {
30+ redoButton.doClick();
31+ }
32+ });
33+ InputMap im = this.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW);
34+ im.put(KeyStroke.getKeyStroke('Z', shortcutkey), "undo");
35+ im.put(KeyStroke.getKeyStroke('Y', shortcutkey), "redo");
36+ }
37+
38 }

Subscribers

People subscribed via source and target branches