Changeset 18472 in josm
- Timestamp:
- 2022-06-08T17:33:09+02:00 (2 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SessionSaveAction.java
r18466 r18472 14 14 import java.io.IOException; 15 15 import java.lang.ref.WeakReference; 16 import java.nio.file.Files; 16 17 import java.util.ArrayList; 17 18 import java.util.Arrays; … … 53 54 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 54 55 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 56 import org.openstreetmap.josm.gui.util.GuiHelper; 55 57 import org.openstreetmap.josm.gui.util.WindowGeometry; 56 58 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; … … 252 254 if (removeFileOnSuccess != null) { 253 255 PreferencesUtils.removeFromList(Config.getPref(), "file-open.history", removeFileOnSuccess.getCanonicalPath()); 254 removeFileOnSuccess.delete();256 Files.deleteIfExists(removeFileOnSuccess.toPath()); 255 257 removeFileOnSuccess = null; 256 258 } 257 259 showSavedNotification(savingNotification, sessionFile.getName()); 260 } catch (SecurityException ex) { 261 Logging.error(ex); 262 if (removeFileOnSuccess != null) { 263 final String path = removeFileOnSuccess.getPath(); 264 GuiHelper.runInEDT(() -> { 265 Notification notification = new Notification(tr("Could not delete file: {0}\r{1}", path, ex.getMessage())); 266 notification.setIcon(JOptionPane.WARNING_MESSAGE); 267 notification.show(); 268 }); 269 } else { 270 // We should never hit this, unless something changes in the try block. 271 throw new JosmRuntimeException(ex); 272 } 258 273 } catch (IOException ex) { 259 274 Logging.error(ex); … … 273 288 /** 274 289 * Sets the current session file. Asks the user if necessary 275 * @param saveAs alwa s ask the user290 * @param saveAs always ask the user 276 291 * @param zipRequired zip 277 292 * @return if the user was asked -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r18467 r18472 97 97 98 98 private transient DataSet dataSet; 99 private ChangeListener changesetTagListener;99 private transient ChangeListener changesetTagListener; 100 100 101 101 /** … … 372 372 * the changeset tags. 373 373 */ 374 public void setChangesetTagsModifiedProgramatically() {374 public synchronized void setChangesetTagsModifiedProgramatically() { 375 375 final Color originalColor = this.tpConfigPanels.getBackgroundAt(1); 376 376 this.tpConfigPanels.setBackgroundAt(1, WARNING_BACKGROUND); … … 383 383 tpConfigPanels.setBackgroundAt(1, originalColor); 384 384 tpConfigPanels.setIconAt(1, ImageProvider.get("apply")); 385 this.tpConfigPanels.removeChangeListener(this.changesetTagListener); 386 changesetTagListener = null; 385 synchronized (this) { 386 this.tpConfigPanels.removeChangeListener(this.changesetTagListener); 387 changesetTagListener = null; 388 } 387 389 } 388 390 }; … … 575 577 if (e.getKey() != null 576 578 && e.getSource() != getClass() 577 && e.getSource() != BasicUploadSettingsPanel.class) { 578 switch (e.getKey()) { 579 case "osm-server.url": 580 osmServerUrlChanged(e.getNewValue()); 581 break; 582 default: 583 return; 584 } 579 && e.getSource() != BasicUploadSettingsPanel.class 580 && "osm-server.url".equals(e.getKey())) { 581 osmServerUrlChanged(e.getNewValue()); 585 582 } 586 583 } … … 643 640 setUploadedPrimitives(null); 644 641 dataSet = null; 645 if (this.changesetTagListener != null) { 646 this.changesetTagListener.stateChanged(null); 647 this.tpConfigPanels.removeChangeListener(this.changesetTagListener); 648 this.changesetTagListener = null; 642 synchronized (this) { 643 if (this.changesetTagListener != null) { 644 this.changesetTagListener.stateChanged(null); 645 this.tpConfigPanels.removeChangeListener(this.changesetTagListener); 646 this.changesetTagListener = null; 647 } 649 648 } 650 649 }
Note:
See TracChangeset
for help on using the changeset viewer.