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:
dragonmacher 2019-06-21 18:37:46 -04:00
parent 8c11c1eebd
commit f510ddf338
4 changed files with 17 additions and 7 deletions

View file

@ -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);
}

View file

@ -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)
*/

View file

@ -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

View file

@ -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) {