Changeset 18362 in josm for trunk/src/org
- Timestamp:
- 2022-01-09T12:16:28+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r18361 r18362 576 576 * Value: The action to execute. 577 577 */ 578 private final Map<String, Action> actions = new ConcurrentHashMap<>();579 578 private final Map<String, Action> regactions = new ConcurrentHashMap<>(); 580 579 … … 1027 1026 } 1028 1027 1029 private void loadAction(DefaultMutableTreeNode node, MenuElement menu ) {1028 private void loadAction(DefaultMutableTreeNode node, MenuElement menu, Map<String, Action> actionsInMenu) { 1030 1029 Object userObject = null; 1031 1030 MenuElement menuElement = menu; … … 1053 1052 } else { 1054 1053 String toolbar = (String) tb; 1055 Action r = actions .get(toolbar);1054 Action r = actionsInMenu.get(toolbar); 1056 1055 if (r != null && r != action && !toolbar.startsWith(IMAGERY_PREFIX)) { 1057 1056 Logging.info(tr("Toolbar action {0} overwritten: {1} gets {2}", 1058 1057 toolbar, r.getClass().getName(), action.getClass().getName())); 1059 1058 } 1060 actions .put(toolbar, action);1059 actionsInMenu.put(toolbar, action); 1061 1060 } 1062 1061 } else { … … 1066 1065 DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(userObject); 1067 1066 node.add(newNode); 1068 loadAction(newNode, item );1069 } 1070 } 1071 1072 private void loadActions( ) {1067 loadAction(newNode, item, actionsInMenu); 1068 } 1069 } 1070 1071 private void loadActions(Map<String, Action> actionsInMenu) { 1073 1072 rootActionsNode.removeAllChildren(); 1074 loadAction(rootActionsNode, MainApplication.getMenu() );1073 loadAction(rootActionsNode, MainApplication.getMenu(), actionsInMenu); 1075 1074 for (Map.Entry<String, Action> a : regactions.entrySet()) { 1076 if (actions .get(a.getKey()) == null) {1075 if (actionsInMenu.get(a.getKey()) == null) { 1077 1076 rootActionsNode.add(new DefaultMutableTreeNode(a.getValue())); 1078 1077 } … … 1099 1098 1100 1099 private Collection<ActionDefinition> getDefinedActions() { 1101 loadActions(); 1100 Map<String, Action> actionsInMenu = new ConcurrentHashMap<>(); 1101 1102 loadActions(actionsInMenu); 1102 1103 1103 1104 Map<String, Action> allActions = new ConcurrentHashMap<>(regactions); 1104 allActions.putAll(actions );1105 allActions.putAll(actionsInMenu); 1105 1106 ActionParser actionParser = new ActionParser(allActions); 1106 1107 … … 1141 1142 } 1142 1143 if (toolbar != null) { 1143 actions.put(toolbar, action);1144 1144 regactions.put(toolbar, action); 1145 1145 } … … 1156 1156 Object toolbar = action.getValue("toolbar"); 1157 1157 if (toolbar instanceof String) { 1158 actions.remove(toolbar);1159 1158 return regactions.remove(toolbar); 1160 1159 }
Note:
See TracChangeset
for help on using the changeset viewer.