Changeset 17628 in josm
- Timestamp:
- 2021-03-21T17:05:43+01:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r16827 r17628 12 12 import java.util.List; 13 13 14 import javax.swing.ImageIcon; 14 15 import javax.swing.JFileChooser; 15 16 import javax.swing.JOptionPane; … … 19 20 import org.openstreetmap.josm.gui.ExtendedDialog; 20 21 import org.openstreetmap.josm.gui.MainApplication; 22 import org.openstreetmap.josm.gui.Notification; 21 23 import org.openstreetmap.josm.gui.io.importexport.FileExporter; 22 24 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; … … 25 27 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 26 28 import org.openstreetmap.josm.spi.preferences.Config; 29 import org.openstreetmap.josm.tools.ImageProvider; 27 30 import org.openstreetmap.josm.tools.Logging; 28 31 import org.openstreetmap.josm.tools.Shortcut; … … 134 137 return false; 135 138 139 ImageIcon icon = ImageProvider.get("save"); 140 Notification savingNotification = new Notification(tr("Saving file {0}...", file.getName())).setIcon(icon); 141 GuiHelper.runInEDT(savingNotification::show); 136 142 try { 137 143 boolean exported = false; … … 169 175 } 170 176 addToFileOpenHistory(file); 177 Notification doneNotification = new Notification(tr("Successfully saved file {0}", file.getName())).setIcon(icon); 178 GuiHelper.runInEDT(() -> doneNotification.replaceExisting(savingNotification)); 171 179 return true; 172 180 } -
trunk/src/org/openstreetmap/josm/gui/Notification.java
r16314 r17628 214 214 } 215 215 216 /** 217 * Display the notification by replacing the given queued/displaying notification 218 * @param oldNotification the notification to replace 219 * @since 17628 220 */ 221 public void replaceExisting(Notification oldNotification) { 222 NotificationManager.getInstance().replaceExistingNotification(oldNotification, this); 223 } 224 216 225 private Object getContentTextOrComponent() { 217 226 return content instanceof JTextComponent ? ((JTextComponent) content).getText() : content; -
trunk/src/org/openstreetmap/josm/gui/NotificationManager.java
r16913 r17628 92 92 * @see Notification#show() 93 93 */ 94 publicvoid showNotification(Notification note) {94 void showNotification(Notification note) { 95 95 synchronized (queue) { 96 96 if (Objects.equals(note, currentNotification) || Objects.equals(note, queue.peekLast())) { … … 99 99 } 100 100 queue.add(note); 101 processQueue(); 102 } 103 } 104 105 /** 106 * Show the given notification by replacing the given queued/displaying notification 107 * @param oldNotification the notification to replace 108 * @param newNotification the notification to show 109 */ 110 void replaceExistingNotification(Notification oldNotification, Notification newNotification) { 111 synchronized (queue) { 112 if (Objects.equals(oldNotification, currentNotification)) { 113 stopHideTimer(); 114 } else { 115 queue.remove(oldNotification); 116 } 117 showNotification(newNotification); 101 118 processQueue(); 102 119 }
Note:
See TracChangeset
for help on using the changeset viewer.