Skip to content

Commit b2610b5

Browse files
Maximilian WittmerMaximilian Wittmer
authored andcommitted
FindReplaceOverlay: add support from mnemonics from the Dialog
In order to preserve the workflow of users who use the Mnemonics of the Find/Replace Dialog a lot, add support to these key combinations as well fixes #2080
1 parent 7587ea1 commit b2610b5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlay.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,22 @@ private final class KeyboardShortcuts {
8282
private static final List<KeyStroke> SEARCH_BACKWARD = List.of( //
8383
KeyStroke.getInstance(SWT.SHIFT, SWT.CR), KeyStroke.getInstance(SWT.SHIFT, SWT.KEYPAD_CR));
8484
private static final List<KeyStroke> SEARCH_ALL = List.of( //
85+
KeyStroke.getInstance(SWT.MOD1, SWT.CR), KeyStroke.getInstance(SWT.MOD1, SWT.KEYPAD_CR),
86+
KeyStroke.getInstance(SWT.ALT, 's'));
87+
private static final List<KeyStroke> REPLACE_ALL = List.of( //
8588
KeyStroke.getInstance(SWT.MOD1, SWT.CR), KeyStroke.getInstance(SWT.MOD1, SWT.KEYPAD_CR));
8689
private static final List<KeyStroke> OPTION_CASE_SENSITIVE = List.of( //
87-
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'C'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'c'));
90+
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'C'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'c'),
91+
KeyStroke.getInstance(SWT.ALT, 'c'));
8892
private static final List<KeyStroke> OPTION_WHOLE_WORD = List.of( //
8993
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'D'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'd'));
9094
private static final List<KeyStroke> OPTION_REGEX = List.of( //
9195
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'P'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'p'));
9296
private static final List<KeyStroke> OPTION_SEARCH_IN_SELECTION = List.of( //
93-
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'I'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'i'));
97+
KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'I'), KeyStroke.getInstance(SWT.MOD1 | SWT.SHIFT, 'i'),
98+
KeyStroke.getInstance(SWT.ALT, 'l'));
9499
private static final List<KeyStroke> CLOSE = List.of( //
95-
KeyStroke.getInstance(SWT.ESC), KeyStroke.getInstance(SWT.MOD1, 'F'),
96-
KeyStroke.getInstance(SWT.MOD1, 'f'));
100+
KeyStroke.getInstance(SWT.ESC), KeyStroke.getInstance(SWT.MOD1, 'F'));
97101
private static final List<KeyStroke> TOGGLE_REPLACE = List.of( //
98102
KeyStroke.getInstance(SWT.MOD1, 'R'), KeyStroke.getInstance(SWT.MOD1, 'r'));
99103
}
@@ -527,7 +531,7 @@ private void createReplaceTools() {
527531
return;
528532
}
529533
performReplaceAll();
530-
}).withShortcuts(KeyboardShortcuts.SEARCH_ALL).build();
534+
}).withShortcuts(KeyboardShortcuts.REPLACE_ALL).build();
531535
}
532536

533537
private ContentAssistCommandAdapter createContentAssistField(HistoryTextWrapper control, boolean isFind) {

bundles/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceShortcutUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static private KeyStroke extractKeyStroke(KeyEvent e) {
3636
if (ctrlDown && e.character != e.keyCode && e.character < 0x20 && (e.keyCode & SWT.KEYCODE_BIT) == 0) {
3737
character += 0x40;
3838
}
39-
KeyStroke actualStroke = KeyStroke.getInstance(e.stateMask & (SWT.MOD1 | SWT.SHIFT),
39+
KeyStroke actualStroke = KeyStroke.getInstance(e.stateMask & (SWT.MOD1 | SWT.SHIFT | SWT.ALT),
4040
character == 0 ? e.keyCode : character);
4141
return actualStroke;
4242
}

0 commit comments

Comments
 (0)