Changeset 14650 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-01-06T12:11:10+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
r14397 r14650 37 37 import org.openstreetmap.josm.gui.Notification; 38 38 import org.openstreetmap.josm.gui.dialogs.PropertiesMembershipChoiceDialog; 39 import org.openstreetmap.josm.gui.dialogs.PropertiesMembershipChoiceDialog.ExistingBothNew Choice;39 import org.openstreetmap.josm.gui.dialogs.PropertiesMembershipChoiceDialog.ExistingBothNew; 40 40 import org.openstreetmap.josm.tools.Logging; 41 41 import org.openstreetmap.josm.tools.Shortcut; … … 180 180 } 181 181 182 private static void updateProperties(ExistingBothNew Choicetags, Node existingNode, Iterable<Node> newNodes, Collection<Command> cmds) {183 if ( tags != null && tags.newNode.isSelected()) {182 private static void updateProperties(ExistingBothNew tags, Node existingNode, Iterable<Node> newNodes, Collection<Command> cmds) { 183 if (ExistingBothNew.NEW.equals(tags)) { 184 184 final Node newSelectedNode = new Node(existingNode); 185 185 newSelectedNode.removeAll(); 186 186 cmds.add(new ChangeCommand(existingNode, newSelectedNode)); 187 } else if ( tags != null && tags.oldNode.isSelected()) {187 } else if (ExistingBothNew.OLD.equals(tags)) { 188 188 for (Node newNode : newNodes) { 189 189 newNode.removeAll(); … … 192 192 } 193 193 194 private static void updateMemberships(ExistingBothNew Choicememberships, Node existingNode, List<Node> newNodes, Collection<Command> cmds) {195 if ( memberships != null && memberships.bothNodes.isSelected()) {194 private static void updateMemberships(ExistingBothNew memberships, Node existingNode, List<Node> newNodes, Collection<Command> cmds) { 195 if (ExistingBothNew.BOTH.equals(memberships)) { 196 196 fixRelations(existingNode, cmds, newNodes, false); 197 } else if ( memberships != null && memberships.newNode.isSelected()) {197 } else if (ExistingBothNew.NEW.equals(memberships)) { 198 198 fixRelations(existingNode, cmds, newNodes, true); 199 199 } … … 203 203 * Assumes there is one tagged Node stored in selectedNode that it will try to unglue. 204 204 * (i.e. copy node and remove all tags from the old one. Relations will not be removed) 205 * @param e event that trig erred the action205 * @param e event that triggered the action 206 206 */ 207 207 private void unglueOneNodeAtMostOneWay(ActionEvent e) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesMembershipChoiceDialog.java
r14320 r14650 31 31 private final transient ExistingBothNewChoice memberships; 32 32 33 public enum ExistingBothNew { 34 OLD, BOTH, NEW 35 } 36 33 37 /** 34 38 * Provides toggle buttons to allow the user choose the existing node, the new nodes, or all of them. 35 39 */ 36 p ublicstatic class ExistingBothNewChoice {40 private static class ExistingBothNewChoice { 37 41 /** The "Existing node" button */ 38 publicfinal AbstractButton oldNode = new JToggleButton(tr("Existing node"), ImageProvider.get("dialogs/conflict/tagkeeptheir"));42 final AbstractButton oldNode = new JToggleButton(tr("Existing node"), ImageProvider.get("dialogs/conflict/tagkeeptheir")); 39 43 /** The "Both nodes" button */ 40 publicfinal AbstractButton bothNodes = new JToggleButton(tr("Both nodes"), ImageProvider.get("dialogs/conflict/tagundecide"));44 final AbstractButton bothNodes = new JToggleButton(tr("Both nodes"), ImageProvider.get("dialogs/conflict/tagundecide")); 41 45 /** The "New node" button */ 42 publicfinal AbstractButton newNode = new JToggleButton(tr("New node"), ImageProvider.get("dialogs/conflict/tagkeepmine"));46 final AbstractButton newNode = new JToggleButton(tr("New node"), ImageProvider.get("dialogs/conflict/tagkeepmine")); 43 47 44 48 ExistingBothNewChoice(final boolean preselectNew) { … … 48 52 tagsGroup.add(newNode); 49 53 tagsGroup.setSelected((preselectNew ? newNode : oldNode).getModel(), true); 54 } 55 56 void add(JPanel content, int gridy) { 57 content.add(oldNode, GBC.std(1, gridy)); 58 content.add(bothNodes, GBC.std(2, gridy)); 59 content.add(newNode, GBC.std(3, gridy)); 60 } 61 62 ExistingBothNew getSelected() { 63 if (oldNode.isSelected()) { 64 return ExistingBothNew.OLD; 65 } else if (bothNodes.isEnabled()) { 66 return ExistingBothNew.BOTH; 67 } else if (newNode.isSelected()) { 68 return ExistingBothNew.NEW; 69 } else { 70 throw new IllegalStateException(); 71 } 50 72 } 51 73 } … … 60 82 content.add(new JLabel(tr("Where should the tags of the node be put?")), GBC.std(1, 1).span(3).insets(0, 20, 0, 0)); 61 83 tags = new ExistingBothNewChoice(preselectNew); 62 content.add(tags.oldNode, GBC.std(1, 2)); 63 content.add(tags.bothNodes, GBC.std(2, 2)); 64 content.add(tags.newNode, GBC.std(3, 2)); 84 tags.add(content, 2); 65 85 } else { 66 86 tags = null; … … 70 90 content.add(new JLabel(tr("Where should the memberships of this node be put?")), GBC.std(1, 3).span(3).insets(0, 20, 0, 0)); 71 91 memberships = new ExistingBothNewChoice(preselectNew); 72 content.add(memberships.oldNode, GBC.std(1, 4)); 73 content.add(memberships.bothNodes, GBC.std(2, 4)); 74 content.add(memberships.newNode, GBC.std(3, 4)); 92 memberships.add(content, 4); 75 93 } else { 76 94 memberships = null; … … 85 103 * @return the tags choice (can be null) 86 104 */ 87 public ExistingBothNew ChoicegetTags() {88 return tags ;105 public ExistingBothNew getTags() { 106 return tags.getSelected(); 89 107 } 90 108 … … 93 111 * @return the memberships choice (can be null) 94 112 */ 95 public ExistingBothNew ChoicegetMemberships() {96 return memberships ;113 public ExistingBothNew getMemberships() { 114 return memberships.getSelected(); 97 115 } 98 116
Note:
See TracChangeset
for help on using the changeset viewer.