mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GT-2925 - Key Bindings - Support Window Menu Provider Key Bindings -
Step 2 - fixed bug that allowed dummy actions into the toolbar; updated DockingAction to handle null keybindings the same way as null menu and toolbar data
This commit is contained in:
@@ -200,6 +200,12 @@ public class DeleteTableRowAction extends DockingAction {
|
||||
|
||||
public DummyDeleteAction(PluginTool tool) {
|
||||
super(NAME, "Tool", DEFAULT_KEYSTROKE);
|
||||
|
||||
// prevent this action from appearing in the toolbar, menus, etc
|
||||
setToolBarData(null);
|
||||
setPopupMenuData(null);
|
||||
setKeyBindingData(null);
|
||||
|
||||
tool.addAction(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -539,11 +539,7 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
|
||||
Fix:
|
||||
|
||||
-Toolbar description for key doesn't match menu (goes away)
|
||||
-dummy actions getting added to toolbar
|
||||
-cleanup odd relationship with keybindings action and UI (move to tool??
|
||||
or ToolActions...<= this)
|
||||
|
||||
-Toolbar description for key doesn't match menu (goes away)
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -80,6 +80,10 @@ public class KeyBindingData {
|
||||
* @return the potentially changed data
|
||||
*/
|
||||
public static KeyBindingData validateKeyBindingData(KeyBindingData newKeyBindingData) {
|
||||
if (newKeyBindingData == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
KeyStroke keyBinding = newKeyBindingData.getKeyBinding();
|
||||
if (keyBinding == null) {
|
||||
// not sure when this can happen
|
||||
|
||||
@@ -300,8 +300,12 @@ public class ToolActions implements PropertyChangeListener {
|
||||
return;
|
||||
}
|
||||
|
||||
KeyBindingData keyBindingData = (KeyBindingData) evt.getNewValue();
|
||||
KeyStroke newKeyStroke = keyBindingData.getKeyBinding();
|
||||
KeyBindingData newKeyBindingData = (KeyBindingData) evt.getNewValue();
|
||||
KeyStroke newKeyStroke = null;
|
||||
if (newKeyBindingData != null) {
|
||||
newKeyStroke = newKeyBindingData.getKeyBinding();
|
||||
}
|
||||
|
||||
Options opt = dockingTool.getOptions(DockingToolConstants.KEY_BINDINGS);
|
||||
KeyStroke optKeyStroke = opt.getKeyStroke(action.getFullName(), null);
|
||||
if (newKeyStroke == null) {
|
||||
|
||||
Reference in New Issue
Block a user