mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
d93d6e9c35
1 changed files with 18 additions and 2 deletions
|
@ -52,8 +52,8 @@ public class MenuKeyProcessor {
|
|||
|
||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||
MenuElement[] path = manager.getSelectedPath();
|
||||
if (path == null || path.length == 0) {
|
||||
return false; // no menu showing
|
||||
if (!hasJPopupMenu(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
KeyStroke eventStroke = KeyStroke.getKeyStrokeForEvent(event);
|
||||
|
@ -67,6 +67,22 @@ public class MenuKeyProcessor {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static boolean hasJPopupMenu(MenuElement[] path) {
|
||||
if (path == null || path.length == 0) {
|
||||
return false; // no menu showing
|
||||
}
|
||||
|
||||
// Checking for the exact class seems to be good enough for now. We can update later if
|
||||
// we find this filters out too many use cases. At the time of writing, we do not want this
|
||||
// code to apply to all popup windows, such as combo box popups.
|
||||
for (MenuElement element : path) {
|
||||
if (element.getClass().equals(JPopupMenu.class)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static KeyStroke keyStroke(String s) {
|
||||
return KeyStroke.getKeyStroke("pressed " + s);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue