public void apply() {
    Keymap[] allKeymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps();
    for (Map.Entry<String, String> pair : myRenamingMap.entrySet()) {
      for (Keymap keymap : allKeymaps) {
        final String oldId = pair.getKey();
        final String newId = pair.getValue();
        keymap.removeAllActionShortcuts(newId);
        for (Shortcut shortcut : keymap.getShortcuts(oldId)) {
          keymap.addShortcut(newId, shortcut);
        }
        keymap.removeAllActionShortcuts(oldId);
      }
    }

    final ActionMacroManager manager = ActionMacroManager.getInstance();
    HashSet<String> removedIds = new HashSet<>();
    for (ActionMacro macro : manager.getAllMacros()) {
      removedIds.add(macro.getActionId());
    }

    manager.removeAllMacros();

    final Enumeration<ActionMacro> newMacros = myMacrosModel.elements();
    while (newMacros.hasMoreElements()) {
      ActionMacro macro = newMacros.nextElement();
      manager.addMacro(macro);
      removedIds.remove(macro.getActionId());
    }
    manager.registerActions(ActionManager.getInstance(), myRenamingMap);

    for (String id : removedIds) {
      for (Keymap keymap : allKeymaps) {
        keymap.removeAllActionShortcuts(id);
      }
    }
  }
public void apply()