Changeset 18135 in josm for trunk/src/org
- Timestamp:
- 2021-08-20T14:18:17+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java
r16553 r18135 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.actions; 3 4 import static org.openstreetmap.josm.tools.I18n.tr; 3 5 4 6 import java.util.Collection; … … 7 9 import javax.swing.filechooser.FileFilter; 8 10 11 import org.openstreetmap.josm.gui.Notification; 12 import org.openstreetmap.josm.gui.util.GuiHelper; 9 13 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 10 14 import org.openstreetmap.josm.gui.widgets.FileChooserManager; 15 import org.openstreetmap.josm.tools.ImageProvider; 11 16 import org.openstreetmap.josm.tools.Shortcut; 12 17 … … 137 142 .openFileChooser(); 138 143 } 144 145 /** 146 * Show "saving file ..." notification and returns it, for future replacement. 147 * @param filename filename of file to save 148 * @return {@link Notification} to provide to {@link #showSavedNotification} once saving is successful 149 * @since 18135 150 */ 151 protected static Notification showSavingNotification(String filename) { 152 Notification savingNotification = new Notification(tr("Saving file {0}...", filename)).setIcon(ImageProvider.get("save")); 153 GuiHelper.runInEDT(savingNotification::show); 154 return savingNotification; 155 } 156 157 /** 158 * Show "Successfully saved file" notification and returns it. 159 * @param savingNotification {@link Notification} returned by {@link #showSavingNotification} 160 * @param filename filename of file saved 161 * @return {@code Notification} displayed 162 * @since 18135 163 */ 164 protected static Notification showSavedNotification(Notification savingNotification, String filename) { 165 Notification doneNotification = new Notification(tr("Successfully saved file {0}", filename)).setIcon(ImageProvider.get("save")); 166 GuiHelper.runInEDT(() -> doneNotification.replaceExisting(savingNotification)); 167 return doneNotification; 168 } 139 169 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r17628 r18135 12 12 import java.util.List; 13 13 14 import javax.swing.ImageIcon;15 14 import javax.swing.JFileChooser; 16 15 import javax.swing.JOptionPane; … … 27 26 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 28 27 import org.openstreetmap.josm.spi.preferences.Config; 29 import org.openstreetmap.josm.tools.ImageProvider;30 28 import org.openstreetmap.josm.tools.Logging; 31 29 import org.openstreetmap.josm.tools.Shortcut; … … 137 135 return false; 138 136 139 ImageIcon icon = ImageProvider.get("save"); 140 Notification savingNotification = new Notification(tr("Saving file {0}...", file.getName())).setIcon(icon); 141 GuiHelper.runInEDT(savingNotification::show); 137 Notification savingNotification = showSavingNotification(file.getName()); 142 138 try { 143 139 boolean exported = false; … … 175 171 } 176 172 addToFileOpenHistory(file); 177 Notification doneNotification = new Notification(tr("Successfully saved file {0}", file.getName())).setIcon(icon); 178 GuiHelper.runInEDT(() -> doneNotification.replaceExisting(savingNotification)); 173 showSavedNotification(savingNotification, file.getName()); 179 174 return true; 180 175 } -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r18133 r18135 38 38 import org.openstreetmap.josm.gui.MapFrame; 39 39 import org.openstreetmap.josm.gui.MapFrameListener; 40 import org.openstreetmap.josm.gui.Notification; 40 41 import org.openstreetmap.josm.gui.layer.Layer; 41 42 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 166 167 SessionWriter sw = new SessionWriter(layersOut, active, exporters, dependencies, zip); 167 168 try { 169 Notification savingNotification = showSavingNotification(file.getName()); 168 170 sw.write(file); 169 171 SaveActionBase.addToFileOpenHistory(file); 172 showSavedNotification(savingNotification, file.getName()); 170 173 } catch (IOException ex) { 171 174 Logging.error(ex);
Note:
See TracChangeset
for help on using the changeset viewer.