void (@NotNull Action action) { ThreadingAssertions.assertEventDispatchThread(); int index = myButtonPanel.getComponentCount(); if (!SystemInfo.isMac && index > 0 && myPresentation.isShowCancelButton()) index--; myButtonPanel.addButtonAction(index, action); Object o = action.getValue(Action.ACCELERATOR_KEY); if (o instanceof KeyStroke) { myTree.registerKeyboardAction(action, (KeyStroke)o, JComponent.WHEN_FOCUSED); } }