diff --git src/org/openstreetmap/josm/gui/io/UploadTextComponentValidator.java src/org/openstreetmap/josm/gui/io/UploadTextComponentValidator.java
index 5d22d2b66..f6f60b671 100644
|
|
|
import org.openstreetmap.josm.tools.Utils;
|
| 21 | 21 | */ |
| 22 | 22 | abstract class UploadTextComponentValidator extends AbstractTextComponentValidator { |
| 23 | 23 | private final JLabel feedback; |
| 24 | | protected boolean uploadRejected; |
| | 24 | protected boolean isUploadCommentRejected; |
| | 25 | protected boolean isUploadSourceRejected; |
| 25 | 26 | |
| 26 | 27 | UploadTextComponentValidator(JTextComponent tc, JLabel feedback) { |
| 27 | 28 | super(tc); |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 65 | 66 | * @since 17238 |
| 66 | 67 | */ |
| 67 | 68 | public final boolean isUploadRejected() { |
| 68 | | return uploadRejected; |
| | 69 | return isUploadCommentRejected || isUploadSourceRejected; |
| 69 | 70 | } |
| 70 | 71 | |
| 71 | 72 | /** |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 84 | 85 | return; |
| 85 | 86 | } |
| 86 | 87 | String uploadComment = getComponent().getText(); |
| 87 | | if (UploadDialog.UploadAction.isUploadCommentTooShort(uploadComment)) { |
| | 88 | String rejection = UploadDialog.UploadAction.validateUploadTag(uploadComment, "upload.comment", |
| | 89 | Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| | 90 | isUploadCommentRejected = rejection != null; |
| | 91 | |
| | 92 | if (isUploadCommentRejected) { |
| | 93 | feedbackWarning(tr("Your upload comment is <i>rejected</i>.") + "<br />" + rejection); |
| | 94 | } else if (UploadDialog.UploadAction.isUploadCommentTooShort(uploadComment)) { |
| 88 | 95 | feedbackWarning(tr("Your upload comment is <i>empty</i>, or <i>very short</i>.<br /><br />" + |
| 89 | 96 | "This is technically allowed, but please consider that many users who are<br />" + |
| 90 | 97 | "watching changes in their area depend on meaningful changeset comments<br />" + |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 92 | 99 | "If you spend a minute now to explain your change, you will make life<br />" + |
| 93 | 100 | "easier for many other mappers.").replace("<br />", " ")); |
| 94 | 101 | } 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 | | } |
| | 102 | feedbackValid(tr("Thank you for providing a changeset comment! " + |
| | 103 | "This gives other mappers a better understanding of your intent.")); |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| … |
… |
abstract class UploadTextComponentValidator extends AbstractTextComponentValidat
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | String uploadSource = getComponent().getText(); |
| 124 | | if (Utils.isStripEmpty(uploadSource)) { |
| | 124 | final String rejection = UploadDialog.UploadAction.validateUploadTag( |
| | 125 | uploadSource, "upload.source", Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); |
| | 126 | isUploadSourceRejected = rejection != null; |
| | 127 | |
| | 128 | if (isUploadSourceRejected) { |
| | 129 | feedbackWarning(tr("Your changeset source is <i>rejected</i>.") + "<br />" + rejection); |
| | 130 | } else if (Utils.isStripEmpty(uploadSource)) { |
| 125 | 131 | feedbackWarning(tr("You did not specify a source for your changes.<br />" + |
| 126 | 132 | "It is technically allowed, but this information helps<br />" + |
| 127 | 133 | "other users to understand the origins of the data.<br /><br />" + |
| 128 | 134 | "If you spend a minute now to explain your change, you will make life<br />" + |
| 129 | 135 | "easier for many other mappers.").replace("<br />", " ")); |
| 130 | 136 | } 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 | | } |
| | 137 | feedbackValid(tr("Thank you for providing the data source!")); |
| 139 | 138 | } |
| 140 | 139 | } |
| 141 | 140 | } |