Changeset 3230 in josm for trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
- Timestamp:
- 2010-05-11T08:41:44+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r3170 r3230 103 103 } 104 104 105 public voidcombineWays(Collection<Way> ways) {105 public Way combineWays(Collection<Way> ways) { 106 106 107 107 // prepare and clean the list of ways to combine 108 108 // 109 109 if (ways == null || ways.isEmpty()) 110 return ;110 return null; 111 111 ways.remove(null); // just in case - remove all null ways from the collection 112 112 ways = new HashSet<Way>(ways); // remove duplicates … … 119 119 if (path == null) { 120 120 warnCombiningImpossible(); 121 return ;121 return null; 122 122 } 123 123 // check whether any ways have been reversed in the process … … 142 142 } 143 143 if ((reversedWays != null) && !reversedWays.isEmpty()) { 144 if (!confirmChangeDirectionOfWays()) return ;144 if (!confirmChangeDirectionOfWays()) return null; 145 145 // filter out ways that have no direction-dependent tags 146 146 unreversedWays = ReverseWayTagCorrector.irreversibleWays(unreversedWays); … … 167 167 } 168 168 catch(UserCancelException ex) { 169 return ;169 return null; 170 170 } 171 171 } … … 207 207 dialog.setVisible(true); 208 208 if (dialog.isCancelled()) 209 return ;209 return null; 210 210 } 211 211 … … 218 218 cmds.add(new DeleteCommand(deletedWays)); 219 219 final SequenceCommand sequenceCommand = new SequenceCommand(tr("Combine {0} ways", ways.size()), cmds); 220 221 // update gui 222 final Way selectedWay = targetWay; 223 Runnable guiTask = new Runnable() { 224 public void run() { 225 Main.main.undoRedo.add(sequenceCommand); 226 getCurrentDataSet().setSelected(selectedWay); 227 } 228 }; 229 if (SwingUtilities.isEventDispatchThread()) { 230 guiTask.run(); 231 } else { 232 SwingUtilities.invokeLater(guiTask); 233 } 220 Main.main.undoRedo.add(sequenceCommand); 221 222 return targetWay; 234 223 } 235 224 … … 248 237 return; 249 238 } 250 combineWays(selectedWays); 239 // combine and update gui 240 final Way selectedWay = combineWays(selectedWays); 241 if(selectedWay != null) 242 { 243 Runnable guiTask = new Runnable() { 244 public void run() { 245 getCurrentDataSet().setSelected(selectedWay); 246 } 247 }; 248 if (SwingUtilities.isEventDispatchThread()) { 249 guiTask.run(); 250 } else { 251 SwingUtilities.invokeLater(guiTask); 252 } 253 } 251 254 } 252 255
Note:
See TracChangeset
for help on using the changeset viewer.