Changeset 18685 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2023-03-07T21:44:32+01:00 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r18613 r18685 573 573 imageEntry.remove(); 574 574 } 575 selectNextImageAfterDeletion(imageEntry); 576 } 577 } 578 579 /** 580 * Select the logical next entry after deleting the currently viewed image 581 * @param oldEntry The image entry that was just deleted 582 */ 583 private void selectNextImageAfterDeletion(IImageEntry<?> oldEntry) { 584 final IImageEntry<?> currentImageEntry = ImageViewerDialog.this.currentEntry; 585 // This is mostly just in case something changes the displayed entry (aka avoid race condition) or an image provider 586 // sets the next image itself. 587 if (Objects.equals(currentImageEntry, oldEntry)) { 588 final IImageEntry<?> nextImage; 589 if (oldEntry instanceof ImageEntry) { 590 nextImage = ((ImageEntry) oldEntry).getDataSet().getSelectedImage(); 591 } else if (oldEntry.getNextImage() != null) { 592 nextImage = oldEntry.getNextImage(); 593 } else if (oldEntry.getPreviousImage() != null) { 594 nextImage = oldEntry.getPreviousImage(); 595 } else { 596 nextImage = null; 597 } 598 ImageViewerDialog.getInstance().displayImages(nextImage == null ? null : Collections.singletonList(nextImage)); 575 599 } 576 600 } … … 588 612 public void actionPerformed(ActionEvent e) { 589 613 if (currentEntry != null) { 590 List<IImageEntry<?>> toDelete = currentEntry instanceof ImageEntry ? 591 new ArrayList<>(((ImageEntry) currentEntry).getDataSet().getSelectedImages()) 592 : Collections.singletonList(currentEntry); 614 IImageEntry<?> oldEntry = ImageViewerDialog.this.currentEntry; 615 List<IImageEntry<?>> toDelete = oldEntry instanceof ImageEntry ? 616 new ArrayList<>(((ImageEntry) oldEntry).getDataSet().getSelectedImages()) 617 : Collections.singletonList(oldEntry); 593 618 int size = toDelete.size(); 594 619 … … 631 656 data.updateSelectedImage(); 632 657 }); 658 ImageViewerDialog.this.imageRemoveAction.selectNextImageAfterDeletion(oldEntry); 633 659 } 634 660 }
Note:
See TracChangeset
for help on using the changeset viewer.