void () { myParent.clearOwnActionsIds(); myChild.clearOwnActionsIds(); String BASE = "BASE_ACTION"; String DEPENDENT = "DEPENDENT_ACTION"; KeymapManagerEx.getInstanceEx().bindShortcuts(BASE, DEPENDENT); try { assertSameElements(myParent.getShortcuts(BASE)); assertSameElements(myParent.getShortcuts(DEPENDENT)); assertSameElements(myParent.getActionIds(shortcut1)); assertSameElements(myChild.getShortcuts(BASE)); assertSameElements(myChild.getShortcuts(DEPENDENT)); assertSameElements(myChild.getActionIds(shortcut1)); // parent: // BASE -> shortcut1 // DEPENDENT -> BASE // child: // - myParent.addShortcut(BASE, shortcut1); // parent: // BASE -> shortcut1 // DEPENDENT -> BASE // child: // BASE -> shortcut1, shortcutA // DEPENDENT -> shortcut1, shortcutA, shortcutB myChild.addShortcut(BASE, shortcutA); myChild.addShortcut(DEPENDENT, shortcutB); assertSameElements(myChild.getShortcuts(BASE), shortcut1, shortcutA); assertSameElements(myChild.getShortcuts(DEPENDENT), shortcut1, shortcutA, shortcutB); assertSameElements(myChild.getActionIds(shortcut1), BASE, DEPENDENT); assertSameElements(myChild.getActionIds(shortcut2)); assertSameElements(myChild.getActionIds(shortcutA), BASE, DEPENDENT); assertSameElements(myChild.getActionIds(shortcutB), DEPENDENT); assertTrue(myChild.hasOwnActionId(BASE)); assertTrue(myChild.hasOwnActionId(DEPENDENT)); // remove from child:BASE first // parent: // BASE -> shortcut1 // DEPENDENT -> BASE // child: // BASE -> shortcut1 // DEPENDENT -> shortcut1, shortcutA, shortcutB myChild.removeShortcut(BASE, shortcutA); assertSameElements(myChild.getShortcuts(BASE), shortcut1); assertSameElements(myChild.getShortcuts(DEPENDENT), shortcut1, shortcutA, shortcutB); assertSameElements(myChild.getActionIds(shortcut1), BASE, DEPENDENT); assertSameElements(myChild.getActionIds(shortcut2)); assertSameElements(myChild.getActionIds(shortcutA), DEPENDENT); assertSameElements(myChild.getActionIds(shortcutB), DEPENDENT); assertFalse(myChild.hasOwnActionId(BASE)); assertTrue(myChild.hasOwnActionId(DEPENDENT)); // remove dependent child:BASE first // parent: // BASE -> shortcut1 // DEPENDENT -> BASE // child: // BASE -> shortcut1 == parent:BASE // DEPENDENT -> shortcut1 == child:BASE myChild.removeShortcut(DEPENDENT, shortcutA); myChild.removeShortcut(DEPENDENT, shortcutB); assertSameElements(myChild.getShortcuts(BASE), shortcut1); assertSameElements(myChild.getShortcuts(DEPENDENT), shortcut1); assertSameElements(myChild.getActionIds(shortcut1), BASE, DEPENDENT); assertSameElements(myChild.getActionIds(shortcut2)); assertSameElements(myChild.getActionIds(shortcutA)); assertSameElements(myChild.getActionIds(shortcutB)); assertFalse(myChild.hasOwnActionId(BASE)); assertFalse(myChild.hasOwnActionId(DEPENDENT)); } finally { KeymapManagerEx.getInstanceEx().unbindShortcuts(DEPENDENT); } }