Changeset 18150 in josm for trunk/src/org
- Timestamp:
- 2021-08-21T03:19:58+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r18018 r18150 22 22 import java.io.IOException; 23 23 import java.util.Objects; 24 import java.util.concurrent.Future; 24 25 25 26 import javax.swing.JComponent; … … 635 636 * Sets a new source image to be displayed by this {@code ImageDisplay}. 636 637 * @param entry new source image 637 * @since 13220 638 * @return a {@link Future} representing pending completion of the image loading task 639 * @since 18150 638 640 */ 639 public voidsetImage(ImageEntry entry) {641 public Future<?> setImage(ImageEntry entry) { 640 642 LoadImageRunnable runnable = setImage0(entry); 641 if (runnable != null) { 642 MainApplication.worker.execute(runnable); 643 } 643 return runnable != null ? MainApplication.worker.submit(runnable) : null; 644 644 } 645 645 -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r18049 r18150 19 19 import java.util.List; 20 20 import java.util.Optional; 21 import java.util.concurrent.Future; 21 22 22 23 import javax.swing.AbstractAction; … … 73 74 74 75 private final ImageDisplay imgDisplay = new ImageDisplay(imageryFilterSettings); 76 private Future<?> imgLoadingFuture; 75 77 private boolean centerView; 76 78 … … 205 207 imageRemoveFromDiskAction.destroy(); 206 208 imageZoomAction.destroy(); 209 cancelLoadingImage(); 207 210 super.destroy(); 208 211 dialog = null; … … 467 470 468 471 if (imageChanged) { 472 cancelLoadingImage(); 469 473 // Set only if the image is new to preserve zoom and position if the same image is redisplayed 470 474 // (e.g. to update the OSD). 471 img Display.setImage(entry);475 imgLoadingFuture = imgDisplay.setImage(entry); 472 476 } 473 477 setTitle(tr("Geotagged Images") + (!entry.getDisplayName().isEmpty() ? " - " + entry.getDisplayName() : "")); … … 628 632 } 629 633 634 private void cancelLoadingImage() { 635 if (imgLoadingFuture != null) { 636 imgLoadingFuture.cancel(false); 637 imgLoadingFuture = null; 638 } 639 } 640 630 641 @Override 631 642 public void selectedImageChanged(ImageData data) { -
trunk/src/org/openstreetmap/josm/gui/progress/swing/ProgressMonitorExecutor.java
r14068 r18150 49 49 ((Future<?>) r).get(); 50 50 } catch (CancellationException cancellationException) { 51 t = cancellationException;51 Logging.debug("Thread {0} raised {1}", Thread.currentThread().getName(), cancellationException); 52 52 } catch (ExecutionException executionException) { 53 53 Logging.trace(executionException);
Note:
See TracChangeset
for help on using the changeset viewer.