- Timestamp:
- 2021-11-01T18:30:38+01:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r18290 r18300 14 14 import java.awt.event.KeyEvent; 15 15 import java.awt.event.WindowEvent; 16 import java.io.IOException; 16 17 import java.io.Serializable; 17 18 import java.time.ZoneOffset; … … 58 59 import org.openstreetmap.josm.tools.ImageProvider; 59 60 import org.openstreetmap.josm.tools.Logging; 61 import org.openstreetmap.josm.tools.PlatformManager; 60 62 import org.openstreetmap.josm.tools.Shortcut; 61 63 import org.openstreetmap.josm.tools.date.DateUtils; … … 80 82 private final ImageLastAction imageLastAction = new ImageLastAction(); 81 83 private final ImageCopyPathAction imageCopyPathAction = new ImageCopyPathAction(); 84 private final ImageOpenExternalAction imageOpenExternalAction = new ImageOpenExternalAction(); 82 85 private final LayerVisibilityAction visibilityAction = new LayerVisibilityAction(Collections::emptyList, 83 86 () -> Collections.singleton(imageryFilterSettings)); … … 115 118 private JButton btnDelete; 116 119 private JButton btnCopyPath; 120 private JButton btnOpenExternal; 117 121 private JButton btnDeleteFromDisk; 118 122 private JToggleButton tbCentre; … … 160 164 btnDeleteFromDisk = createButton(imageRemoveFromDiskAction, buttonDim); 161 165 btnCopyPath = createButton(imageCopyPathAction, buttonDim); 166 btnOpenExternal = createButton(imageOpenExternalAction, buttonDim); 162 167 163 168 btnNext = createNavigationButton(imageNextAction, buttonDim); … … 186 191 buttons.add(Box.createRigidArea(new Dimension(7, 0))); 187 192 buttons.add(btnCopyPath); 193 buttons.add(btnOpenExternal); 188 194 buttons.add(Box.createRigidArea(new Dimension(7, 0))); 189 195 buttons.add(createButton(visibilityAction, buttonDim)); … … 220 226 imageCollapseAction.destroy(); 221 227 imageCopyPathAction.destroy(); 228 imageOpenExternalAction.destroy(); 222 229 imageRemoveAction.destroy(); 223 230 imageRemoveFromDiskAction.destroy(); … … 230 237 /** 231 238 * This literally exists to silence sonarlint complaints. 239 * @param <I> the type of the operand and result of the operator 232 240 */ 233 241 @FunctionalInterface … … 494 502 } 495 503 504 private class ImageOpenExternalAction extends JosmAction { 505 ImageOpenExternalAction() { 506 super(null, new ImageProvider("external-link"), tr("Open image in external viewer"), null, false, null, false); 507 } 508 509 @Override 510 public void actionPerformed(ActionEvent e) { 511 if (currentEntry != null) { 512 try { 513 PlatformManager.getPlatform().openUrl(currentEntry.getFile().toURI().toURL().toExternalForm()); 514 } catch (IOException ex) { 515 Logging.error(ex); 516 } 517 } 518 } 519 } 520 496 521 /** 497 522 * Enables (or disables) the "Previous" button. … … 605 630 btnDeleteFromDisk.setEnabled(hasMultipleImages); 606 631 btnCopyPath.setEnabled(false); 632 btnOpenExternal.setEnabled(false); 607 633 if (hasMultipleImages) { 608 634 imgDisplay.setEmptyText(tr("Multiple images selected")); … … 633 659 btnDeleteFromDisk.setEnabled(entry.isDeleteSupported() && entry.isRemoveSupported()); 634 660 btnCopyPath.setEnabled(true); 661 btnOpenExternal.setEnabled(true); 635 662 636 663 setTitle(tr("Geotagged Images") + (!entry.getDisplayName().isEmpty() ? " - " + entry.getDisplayName() : ""));
Note:
See TracChangeset
for help on using the changeset viewer.