Changeset 15358 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2019-09-19T12:26:55+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/downloadtasks
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r15332 r15358 49 49 50 50 private static final String PATTERN_COMPRESS = "https?://.*/(.*\\.osn.(gz|xz|bz2?|zip))"; 51 private static final String NO_NOTES_FOUND = tr("No notes found in this area."); 52 static { 53 PostDownloadHandler.addNoDataErrorMessage(NO_NOTES_FOUND); 54 } 51 55 52 56 private DownloadTask downloadTask; … … 133 137 if (notesData.isEmpty()) { 134 138 if (warnAboutEmptyArea) { 135 rememberErrorMessage( tr("No notes found in this area."));139 rememberErrorMessage(NO_NOTES_FOUND); 136 140 } 137 141 return; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r15353 r15358 63 63 64 64 protected static final String OVERPASS_INTERPRETER_DATA = "interpreter?data="; 65 66 private static final String NO_DATA_FOUND = tr("No data found in this area."); 67 static { 68 PostDownloadHandler.addNoDataErrorMessage(NO_DATA_FOUND); 69 } 65 70 66 71 @Override … … 466 471 if (dataSet.allPrimitives().isEmpty()) { 467 472 if (warnAboutEmptyArea) { 468 rememberErrorMessage( tr("No data found in this area."));473 rememberErrorMessage(NO_DATA_FOUND); 469 474 } 470 475 String remark = dataSet.getRemark(); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r15353 r15358 264 264 265 265 GuiHelper.runInEDT(() -> { 266 if (items.size() == 1 && tr("No data found in this area.").equals(items.iterator().next())) {266 if (items.size() == 1 && PostDownloadHandler.isNoDataErrorMessage(items.iterator().next())) { 267 267 new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 268 268 } else { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r14153 r15358 7 7 import java.util.ArrayList; 8 8 import java.util.Collection; 9 import java.util.HashSet; 9 10 import java.util.LinkedHashSet; 10 11 import java.util.Set; … … 34 35 private Consumer<Collection<Object>> errorReporter; 35 36 37 private static final Set<String> NO_DATA_ERROR_MESSAGES = new HashSet<>(); 38 36 39 /** 37 40 * Creates a new {@link PostDownloadHandler} … … 54 57 this(task, future); 55 58 this.errorReporter = errorReporter; 59 } 60 61 /** 62 * Adds a new translated error message indicating that no data has been downloaded. 63 * @param message new translated error message indicating that no data has been downloaded. 64 * @return {@code true} if the message was not already known 65 * @since 15358 66 */ 67 public static boolean addNoDataErrorMessage(String message) { 68 return NO_DATA_ERROR_MESSAGES.add(message); 69 } 70 71 /** 72 * Determines if a translated error message indicates that no data has been downloaded. 73 * @param message translated error message to check 74 * @return {@code true} if the message indicates that no data has been downloaded 75 * @since 15358 76 */ 77 public static boolean isNoDataErrorMessage(Object message) { 78 return NO_DATA_ERROR_MESSAGES.contains(message); 56 79 } 57 80 … … 87 110 if (error instanceof Exception) { 88 111 ExceptionDialogUtil.explainException((Exception) error); 89 } else if ( tr("No data found in this area.").equals(error)) {112 } else if (isNoDataErrorMessage(error)) { 90 113 new Notification(error.toString()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 91 114 } else {
Note:
See TracChangeset
for help on using the changeset viewer.