- Timestamp:
- 2015-05-23T11:31:58+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r8395 r8422 25 25 import java.util.Collection; 26 26 import java.util.Collections; 27 import java.util.HashMap;28 27 import java.util.LinkedList; 29 28 import java.util.List; 30 29 import java.util.Map; 30 import java.util.concurrent.ConcurrentHashMap; 31 31 32 32 import javax.swing.AbstractAction; … … 83 83 private String icon = ""; 84 84 private ImageIcon ico = null; 85 private final Map<String, Object> parameters = new HashMap<>(); 85 private final Map<String, Object> parameters = new ConcurrentHashMap<>(); 86 86 87 87 public ActionDefinition(Action action) { … … 209 209 210 210 ParameterizedAction parametrizedAction = (ParameterizedAction)action; 211 Map<String, ActionParameter<?>> actionParams = new HashMap<>(); 211 Map<String, ActionParameter<?>> actionParams = new ConcurrentHashMap<>(); 212 212 for (ActionParameter<?> param: parametrizedAction.getActionParameters()) { 213 213 actionParams.put(param.getName(), param); … … 218 218 skip('='); 219 219 String paramValue = readTillChar(',',')'); 220 if (paramName.length() > 0) { 220 if (paramName.length() > 0 && paramValue.length() > 0) { 221 221 ActionParameter<?> actionParam = actionParams.get(paramName); 222 222 if (actionParam != null) { … … 369 369 @Override 370 370 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 371 String val = (String) aValue; 372 int paramIndex = rowIndex; 373 371 374 if(currentAction.getAction() instanceof AdaptableAction) { 372 375 if (rowIndex == 0) { 373 currentAction.setName( (String)aValue);376 currentAction.setName(val); 374 377 return; 375 378 } else if (rowIndex == 1) { 376 currentAction.setIcon( (String)aValue);379 currentAction.setIcon(val); 377 380 return; 378 381 } else { 379 rowIndex -= 2; 380 } 381 } 382 ActionParameter<Object> param = getParam(rowIndex); 383 currentAction.getParameters().put(param.getName(), param.readFromString((String)aValue)); 382 paramIndex -= 2; 383 } 384 } 385 ActionParameter<Object> param = getParam(paramIndex); 386 387 if (param != null && val.length() > 0) { 388 currentAction.getParameters().put(param.getName(), param.readFromString((String)aValue)); 389 } 384 390 } 385 391 … … 470 476 * Value: The action to execute. 471 477 */ 472 private final Map<String, Action> actions = new HashMap<>(); 473 private final Map<String, Action> regactions = new HashMap<>(); 478 private final Map<String, Action> actions = new ConcurrentHashMap<>(); 479 private final Map<String, Action> regactions = new ConcurrentHashMap<>(); 474 480 475 481 private final DefaultMutableTreeNode rootActionsNode = new DefaultMutableTreeNode(tr("Actions")); 476 482 477 483 public JToolBar control = new JToolBar(); 478 private final Map<Object, ActionDefinition> buttonActions = new HashMap<>(30); 484 private final Map<Object, ActionDefinition> buttonActions = new ConcurrentHashMap<>(30); 479 485 480 486 @Override … … 971 977 loadActions(); 972 978 973 Map<String, Action> allActions = new HashMap<>(regactions); 979 Map<String, Action> allActions = new ConcurrentHashMap<>(regactions); 974 980 allActions.putAll(actions); 975 981 ActionParser actionParser = new ActionParser(allActions);
Note:
See TracChangeset
for help on using the changeset viewer.