Ticket #21730: 21730.patch
| File 21730.patch, 2.8 KB (added by , 4 years ago) |
|---|
-
src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
575 575 * Key: Registered name (property "toolbar" of action). 576 576 * Value: The action to execute. 577 577 */ 578 private final Map<String, Action> actions = new ConcurrentHashMap<>();578 private final Map<String, Action> actionsInMenu = new ConcurrentHashMap<>(); 579 579 private final Map<String, Action> regactions = new ConcurrentHashMap<>(); 580 580 581 581 private final DefaultMutableTreeNode rootActionsNode = new DefaultMutableTreeNode(tr("Actions")); … … 1051 1051 continue; 1052 1052 } else { 1053 1053 String toolbar = (String) tb; 1054 Action r = actions .get(toolbar);1054 Action r = actionsInMenu.get(toolbar); 1055 1055 if (r != null && r != action && !toolbar.startsWith(IMAGERY_PREFIX)) { 1056 1056 Logging.info(tr("Toolbar action {0} overwritten: {1} gets {2}", 1057 1057 toolbar, r.getClass().getName(), action.getClass().getName())); 1058 1058 } 1059 actions .put(toolbar, action);1059 actionsInMenu.put(toolbar, action); 1060 1060 } 1061 1061 } else { 1062 1062 userObject = menuItem.getText(); … … 1069 1069 } 1070 1070 1071 1071 private void loadActions() { 1072 actionsInMenu.clear(); 1072 1073 rootActionsNode.removeAllChildren(); 1073 1074 loadAction(rootActionsNode, MainApplication.getMenu()); 1074 1075 for (Map.Entry<String, Action> a : regactions.entrySet()) { 1075 if (actions .get(a.getKey()) == null) {1076 if (actionsInMenu.get(a.getKey()) == null) { 1076 1077 rootActionsNode.add(new DefaultMutableTreeNode(a.getValue())); 1077 1078 } 1078 1079 } … … 1100 1101 loadActions(); 1101 1102 1102 1103 Map<String, Action> allActions = new ConcurrentHashMap<>(regactions); 1103 allActions.putAll(actions );1104 allActions.putAll(actionsInMenu); 1104 1105 ActionParser actionParser = new ActionParser(allActions); 1105 1106 1106 1107 Collection<ActionDefinition> result = new ArrayList<>(); … … 1139 1140 } 1140 1141 } 1141 1142 if (toolbar != null) { 1142 actions.put(toolbar, action);1143 1143 regactions.put(toolbar, action); 1144 1144 } 1145 1145 return action; … … 1154 1154 public Action unregister(Action action) { 1155 1155 Object toolbar = action.getValue("toolbar"); 1156 1156 if (toolbar instanceof String) { 1157 actions.remove(toolbar);1158 1157 return regactions.remove(toolbar); 1159 1158 } 1160 1159 return null;
