- Timestamp:
- 2021-04-13T22:20:19+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r17399 r17772 347 347 /** 348 348 * Return primitives that are affected by some command 349 * @param path GUI elements 350 * @return collection of affected primitives, onluy usable ones 351 */ 352 protected static Collection<? extends OsmPrimitive> getAffectedPrimitives(TreePath path) { 353 PseudoCommand c = ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand(); 349 * @param c the command 350 * @return collection of affected primitives, only usable ones 351 */ 352 protected static Collection<? extends OsmPrimitive> getAffectedPrimitives(PseudoCommand c) { 354 353 final OsmDataLayer currentLayer = MainApplication.getLayerManager().getEditLayer(); 355 354 return new SubclassFilteredCollection<>( … … 425 424 @Override 426 425 public void actionPerformed(ActionEvent e) { 427 TreePath path; 428 if (!undoTree.isSelectionEmpty()) { 429 path = undoTree.getSelectionPath(); 430 } else if (!redoTree.isSelectionEmpty()) { 431 path = redoTree.getSelectionPath(); 432 } else { 433 // see #19514 for a possible cause 426 PseudoCommand command = getSelectedCommand(); 427 if (command == null) { 434 428 return; 435 429 } … … 437 431 DataSet dataSet = MainApplication.getLayerManager().getEditDataSet(); 438 432 if (dataSet == null) return; 439 dataSet.setSelected(getAffectedPrimitives( path));433 dataSet.setSelected(getAffectedPrimitives(command)); 440 434 } 441 435 … … 444 438 setEnabled(!undoTree.isSelectionEmpty() || !redoTree.isSelectionEmpty()); 445 439 } 440 } 441 442 /** 443 * Returns the selected undo/redo command 444 * @return the selected undo/redo command or {@code null} 445 */ 446 public PseudoCommand getSelectedCommand() { 447 TreePath path; 448 if (!undoTree.isSelectionEmpty()) { 449 path = undoTree.getSelectionPath(); 450 } else if (!redoTree.isSelectionEmpty()) { 451 path = redoTree.getSelectionPath(); 452 } else { 453 // see #19514 for a possible cause 454 return null; 455 } 456 return path != null ? ((CommandListMutableTreeNode) path.getLastPathComponent()).getCommand() : null; 446 457 } 447 458
Note:
See TracChangeset
for help on using the changeset viewer.