mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
@@ -52,8 +52,8 @@ public class MenuKeyProcessor {
|
|||||||
|
|
||||||
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
MenuSelectionManager manager = MenuSelectionManager.defaultManager();
|
||||||
MenuElement[] path = manager.getSelectedPath();
|
MenuElement[] path = manager.getSelectedPath();
|
||||||
if (path == null || path.length == 0) {
|
if (!hasJPopupMenu(path)) {
|
||||||
return false; // no menu showing
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyStroke eventStroke = KeyStroke.getKeyStrokeForEvent(event);
|
KeyStroke eventStroke = KeyStroke.getKeyStrokeForEvent(event);
|
||||||
@@ -67,6 +67,22 @@ public class MenuKeyProcessor {
|
|||||||
return false;
|
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) {
|
private static KeyStroke keyStroke(String s) {
|
||||||
return KeyStroke.getKeyStroke("pressed " + s);
|
return KeyStroke.getKeyStroke("pressed " + s);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user