Changeset 14662 in josm for trunk/src/org
- Timestamp:
- 2019-01-07T19:46:32+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r14654 r14662 178 178 179 179 static void update(PropertiesMembershipChoiceDialog dialog, Node existingNode, List<Node> newNodes, Collection<Command> cmds) { 180 updateMemberships(dialog.getMemberships() , existingNode, newNodes, cmds);181 updateProperties(dialog.getTags() , existingNode, newNodes, cmds);180 updateMemberships(dialog.getMemberships().orElse(null), existingNode, newNodes, cmds); 181 updateProperties(dialog.getTags().orElse(null), existingNode, newNodes, cmds); 182 182 } 183 183 … … 213 213 List<Command> cmds = new LinkedList<>(); 214 214 cmds.add(new AddCommand(selectedNode.getDataSet(), unglued)); 215 if (dialog != null && ExistingBothNew.NEW.equals(dialog.getTags() )) {215 if (dialog != null && ExistingBothNew.NEW.equals(dialog.getTags().orElse(null))) { 216 216 // unglued node gets the ID and history, thus replace way node with a fresh one 217 217 final Way way = selectedNode.getParentWays().get(0); … … 219 219 newWayNodes.replaceAll(n -> selectedNode.equals(n) ? unglued : n); 220 220 cmds.add(new ChangeNodesCommand(way, newWayNodes)); 221 updateMemberships(dialog.getMemberships().opposite(), selectedNode, Collections.singletonList(unglued), cmds); 222 updateProperties(dialog.getTags().opposite(), selectedNode, Collections.singletonList(unglued), cmds); 221 updateMemberships(dialog.getMemberships().map(ExistingBothNew::opposite).orElse(null), 222 selectedNode, Collections.singletonList(unglued), cmds); 223 updateProperties(dialog.getTags().map(ExistingBothNew::opposite).orElse(null), 224 selectedNode, Collections.singletonList(unglued), cmds); 223 225 moveSelectedNode = true; 224 226 } else if (dialog != null) { … … 386 388 */ 387 389 private static void updateMemberships(ExistingBothNew memberships, Node originalNode, List<Node> newNodes, Collection<Command> cmds) { 388 if ( ExistingBothNew.OLD.equals(memberships)) {390 if (memberships == null || ExistingBothNew.OLD.equals(memberships)) { 389 391 return; 390 392 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesMembershipChoiceDialog.java
r14654 r14662 7 7 import java.util.Collection; 8 8 import java.util.Objects; 9 import java.util.Optional; 9 10 10 11 import javax.swing.AbstractButton; … … 113 114 /** 114 115 * Returns the tags choice. 115 * @return the tags choice (can be null)116 * @return the tags choice 116 117 */ 117 public ExistingBothNewgetTags() {118 return tags.getSelected();118 public Optional<ExistingBothNew> getTags() { 119 return Optional.ofNullable(tags).map(ExistingBothNewChoice::getSelected); 119 120 } 120 121 121 122 /** 122 123 * Returns the memberships choice. 123 * @return the memberships choice (can be null)124 * @return the memberships choice 124 125 */ 125 public ExistingBothNewgetMemberships() {126 return memberships.getSelected();126 public Optional<ExistingBothNew> getMemberships() { 127 return Optional.ofNullable(memberships).map(ExistingBothNewChoice::getSelected); 127 128 } 128 129
Note:
See TracChangeset
for help on using the changeset viewer.