- Timestamp:
- 2010-10-03T14:39:11+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r3223 r3583 69 69 70 70 public static class ActionDefinition { 71 72 public static ActionDefinition SEPARATOR = new ActionDefinition(null);73 74 71 private final Action action; 75 72 private final Map<String, Object> parameters = new HashMap<String, Object>(); … … 94 91 } 95 92 93 public boolean isSeparator() { 94 return action == null; 95 } 96 97 public static ActionDefinition getSeparator() { 98 return new ActionDefinition(null); 99 } 96 100 } 97 101 … … 207 211 private static class ActionParametersTableModel extends AbstractTableModel { 208 212 209 private ActionDefinition currentAction = ActionDefinition. SEPARATOR;213 private ActionDefinition currentAction = ActionDefinition.getSeparator(); 210 214 211 215 public int getColumnCount() { … … 214 218 215 219 public int getRowCount() { 216 if (currentAction == ActionDefinition.SEPARATOR|| !(currentAction.getAction() instanceof ParameterizedAction))220 if (currentAction.isSeparator() || !(currentAction.getAction() instanceof ParameterizedAction)) 217 221 return 0; 218 222 ParameterizedAction pa = (ParameterizedAction)currentAction.getAction(); … … 286 290 DefaultMutableTreeNode node = (DefaultMutableTreeNode) selectedAction.getLastPathComponent(); 287 291 if (node.getUserObject() == null) { 288 selected.add(leadItem++, ActionDefinition. SEPARATOR);292 selected.add(leadItem++, ActionDefinition.getSeparator()); 289 293 } else if (node.getUserObject() instanceof Action) { 290 294 selected.add(leadItem++, new ActionDefinition((Action)node.getUserObject())); … … 410 414 String s; 411 415 Icon i; 412 if (value !=ActionDefinition.SEPARATOR) {413 ActionDefinition action = (ActionDefinition)value;416 ActionDefinition action = (ActionDefinition)value; 417 if (!action.isSeparator()) { 414 418 s = (String) action.getAction().getValue(Action.NAME); 415 419 i = (Icon) action.getAction().getValue(Action.SMALL_ICON); … … 561 565 Object obj = node.getUserObject(); 562 566 if (obj == null) { 563 dragActions.add(ActionDefinition. SEPARATOR);567 dragActions.add(ActionDefinition.getSeparator()); 564 568 } 565 569 else if (obj instanceof Action) { … … 642 646 ActionParser parser = new ActionParser(null); 643 647 for (int i = 0; i < selected.size(); ++i) { 644 if (selected.get(i) ==ActionDefinition.SEPARATOR) {645 648 ActionDefinition action = (ActionDefinition)selected.get(i); 649 if (action.isSeparator()) { 646 650 t.add("|"); 647 648 651 } else { 649 t.add(parser.saveAction( (ActionDefinition)(selected.get(i))));652 t.add(parser.saveAction(action)); 650 653 } 651 654 } … … 731 734 for (String s : getToolString()) { 732 735 if (s.equals("|")) { 733 result.add(ActionDefinition. SEPARATOR);736 result.add(ActionDefinition.getSeparator()); 734 737 } else { 735 738 ActionDefinition a = actionParser.loadAction(s); … … 761 764 762 765 for (ActionDefinition action : getDefinedActions()) { 763 if (action == ActionDefinition.SEPARATOR) {766 if (action.isSeparator()) { 764 767 control.addSeparator(); 765 766 768 } else { 767 769 Action a = action.getParametrizedAction();
Note:
See TracChangeset
for help on using the changeset viewer.