Changeset 15352 in josm for trunk/src/org


Ignore:
Timestamp:
2019-09-15T23:54:42+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #18130 - Select next image after remove (patch by francois2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/ImageData.java

    r15348 r15352  
    247247     */
    248248    public void removeSelectedImage() {
    249         List<ImageEntry> selected = getSelectedImages();
    250         if (selected.size() > 1) {
     249        List<ImageEntry> selectedImages = getSelectedImages();
     250        if (selectedImages.size() > 1) {
    251251            throw new IllegalStateException(tr("Multiple images have been selected"));
    252252        }
    253         if (selected.isEmpty()) {
     253        removeImages(selectedImages);
     254    }
     255
     256    /**
     257     * Remove the current selected image from the list
     258     * @since 15348
     259     */
     260    public void removeSelectedImages() {
     261        List<ImageEntry> selectedImages = getSelectedImages();
     262        removeImages(selectedImages);
     263    }
     264
     265    private void removeImages(List<ImageEntry> selectedImages) {
     266        if (selectedImages.isEmpty()) {
    254267            return;
    255268        }
    256         data.remove(getSelectedImages().get(0));
     269        for (ImageEntry img: getSelectedImages()) {
     270            data.remove(img);
     271        }
    257272        if (selectedImagesIndex.get(0) == data.size()) {
    258273            setSelectedImageIndex(data.size() - 1);
     
    263278
    264279    /**
    265      * Remove the current selected image from the list
    266      * @since 15348
    267      */
    268     public void removeSelectedImages() {
    269         List<ImageEntry> selected = getSelectedImages();
    270         if (selected.isEmpty()) {
    271             return;
    272         }
    273         for (ImageEntry img: getSelectedImages()) {
    274             data.remove(img);
    275         }
    276         setSelectedImageIndex(-1, true);
    277     }
    278 
    279     /**
    280280     * Determines if the image is selected
    281281     * @param image the {@link ImageEntry} image
Note: See TracChangeset for help on using the changeset viewer.