diff --git src/org/openstreetmap/josm/gui/io/UploadDialog.java src/org/openstreetmap/josm/gui/io/UploadDialog.java
index 3db79d8ee..a50637e83 100644
|
|
|
public class UploadDialog extends AbstractUploadDialog implements PropertyChange
|
| 219 | 219 | |
| 220 | 220 | pnlBasicUploadSettings.setUploadTagDownFocusTraversalHandlers(e -> btnUpload.requestFocusInWindow()); |
| 221 | 221 | |
| | 222 | // Set the initial state of the upload button |
| | 223 | btnUpload.setEnabled(pnlBasicUploadSettings.getUploadTextValidators() |
| | 224 | .stream().noneMatch(UploadTextComponentValidator::isUploadRejected)); |
| | 225 | |
| 222 | 226 | // Enable/disable the upload button if at least an upload validator rejects upload |
| 223 | 227 | pnlBasicUploadSettings.getUploadTextValidators().forEach(v -> v.addChangeListener(e -> btnUpload.setEnabled( |
| 224 | 228 | pnlBasicUploadSettings.getUploadTextValidators().stream().noneMatch(UploadTextComponentValidator::isUploadRejected)))); |
diff --git src/org/openstreetmap/josm/gui/io/UploadTextComponentValidator.java src/org/openstreetmap/josm/gui/io/UploadTextComponentValidator.java
index 5d22d2b66..275baa1b3 100644
|
|
|
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 83 | 83 | feedbackDisabled(); |
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | | String uploadComment = getComponent().getText(); |
| 87 | | if (UploadDialog.UploadAction.isUploadCommentTooShort(uploadComment)) { |
| | 86 | final String uploadComment = getComponent().getText(); |
| | 87 | final String rejection = UploadDialog.UploadAction.validateUploadTag(uploadComment, "upload.comment", |
| | 88 | Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| | 89 | |
| | 90 | // Reject the upload only if tags are required and are not in the input. If the tags exist or are not |
| | 91 | // required, then check the length of the input and warn if it's too short (a short msg is not a rejection) |
| | 92 | uploadRejected = rejection != null; |
| | 93 | |
| | 94 | if (uploadRejected) { |
| | 95 | feedbackWarning(tr("Your upload comment is <i>rejected</i>.") + "<br />" + rejection); |
| | 96 | } else if (UploadDialog.UploadAction.isUploadCommentTooShort(uploadComment)) { |
| 88 | 97 | feedbackWarning(tr("Your upload comment is <i>empty</i>, or <i>very short</i>.<br /><br />" + |
| 89 | 98 | "This is technically allowed, but please consider that many users who are<br />" + |
| 90 | 99 | "watching changes in their area depend on meaningful changeset comments<br />" + |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 92 | 101 | "If you spend a minute now to explain your change, you will make life<br />" + |
| 93 | 102 | "easier for many other mappers.").replace("<br />", " ")); |
| 94 | 103 | } else { |
| 95 | | String rejection = UploadDialog.UploadAction.validateUploadTag(uploadComment, "upload.comment", |
| 96 | | Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| 97 | | uploadRejected = rejection != null; |
| 98 | | if (uploadRejected) { |
| 99 | | feedbackWarning(tr("Your upload comment is <i>rejected</i>.") + "<br />" + rejection); |
| 100 | | } else { |
| 101 | | feedbackValid(tr("Thank you for providing a changeset comment! " + |
| 102 | | "This gives other mappers a better understanding of your intent.")); |
| 103 | | } |
| | 104 | feedbackValid(tr("Thank you for providing a changeset comment! " + |
| | 105 | "This gives other mappers a better understanding of your intent.")); |
| 104 | 106 | } |
| 105 | 107 | } |
| 106 | 108 | } |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 120 | 122 | feedbackDisabled(); |
| 121 | 123 | return; |
| 122 | 124 | } |
| 123 | | String uploadSource = getComponent().getText(); |
| 124 | | if (Utils.isStripEmpty(uploadSource)) { |
| | 125 | final String uploadSource = getComponent().getText(); |
| | 126 | final String rejection = UploadDialog.UploadAction.validateUploadTag( |
| | 127 | uploadSource, "upload.source", Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| | 128 | |
| | 129 | // Reject the upload only if tags are required and are not in the input. If the tags exist or are not |
| | 130 | // required, then check the length of the input and warn if it's too short (a short msg is not a rejection) |
| | 131 | uploadRejected = rejection != null; |
| | 132 | |
| | 133 | if (uploadRejected) { |
| | 134 | feedbackWarning(tr("Your changeset source is <i>rejected</i>.") + "<br />" + rejection); |
| | 135 | } else if (Utils.isStripEmpty(uploadSource)) { |
| 125 | 136 | feedbackWarning(tr("You did not specify a source for your changes.<br />" + |
| 126 | 137 | "It is technically allowed, but this information helps<br />" + |
| 127 | 138 | "other users to understand the origins of the data.<br /><br />" + |
| 128 | 139 | "If you spend a minute now to explain your change, you will make life<br />" + |
| 129 | 140 | "easier for many other mappers.").replace("<br />", " ")); |
| 130 | 141 | } else { |
| 131 | | final String rejection = UploadDialog.UploadAction.validateUploadTag( |
| 132 | | uploadSource, "upload.source", Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| 133 | | uploadRejected = rejection != null; |
| 134 | | if (uploadRejected) { |
| 135 | | feedbackWarning(tr("Your changeset source is <i>rejected</i>.") + "<br />" + rejection); |
| 136 | | } else { |
| 137 | | feedbackValid(tr("Thank you for providing the data source!")); |
| 138 | | } |
| | 142 | feedbackValid(tr("Thank you for providing the data source!")); |
| 139 | 143 | } |
| 140 | 144 | } |
| 141 | 145 | } |