-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JBIDE 21068] Set maximum length for display name for project wizard #1186
Conversation
The maximum limit should be limited to what the max allowed by the server. On Wednesday, May 25, 2016, Dmitry notifications@github.com wrote:
Jeff Cantrill |
@@ -96,6 +98,9 @@ public IStatus validate(Object value) { | |||
if(param.contains("\t") || param.contains("\n")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace "\n" with SWT.LF and "\t" with SWT.TAB
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adietish ok
Text.setTextLimit(limit) isnt platform specific. Only the constant Text.LIMIT is platform specific, but we dont need this constant anyhow. |
@jcantrill , @adietish ok, i'll fix it to the maximum length for annotation. |
@bdshadow ok, added an explanation to the jira description for the fact that the maximum length should get derived from the maximum lenght of OpenShift annotations |
@bdshadow can you please always use the JBIDE-XXX identifier in your commit message. This way you can instantly see what jira issue a PR is fixing and the same is ture when reading commits in git log. |
@adietish thank you. Yes, ofcourse, i'll fix it |
Can you please add some unit tests on the validator, you might need to refactor some code to make it testable |
@jcantrill and me discussed it. The only limitation for annotations is that its' total length can't exceed 2^63 (see here). Web Console also doesn't limit the display name. So int64 in go-lang is the maximum value for display name; @fbricon yes, i'll add it |
|
||
@Override | ||
public IStatus validate(Object value) { | ||
if(value != null && !(value instanceof String)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value != null is redundant with !(value instanceof String)
Aside from a couple minuscule issues, LGTM. Will merge once @bdshadow updates the PR |
The limit is, actually, set in swt Text and it is platform dependent. In my Fedora 23
always returns 0xFFFF which is exactly 65536. So couldn't test it in a usual way, but just setting the limit lower for testing purposes.
However, i added ValidationStatus.error when input is bigger so that this check works in another OSs.