void (@Nullable ActionManager actionManager) { if (actionManager == null) { return; } unregisterActions(actionManager); // register // to prevent exception if 2 or more targets have the same name Set<String> registeredIds = new HashSet<>(); for (T tool : getTools()) { String actionId = tool.getActionId(); if (registeredIds.add(actionId)) { actionManager.registerAction(actionId, createToolAction(tool)); } } }