public IStatus validate(String text) { StatusInfo status = new StatusInfo(); if (text.trim().length() == 0) { status.setError(Messages.FieldIsEmpty); } return status; }
public IStatus validate(String text) { StatusInfo status = (StatusInfo) super.validate(text); if (!status.isOK()) { return status; } int value = Integer.parseInt(text); if (value < minValue) { status.setError( MessageFormat.format( Messages.MinValueInvalid, new Object[] {String.valueOf(minValue)})); } return status; }
public IStatus validate(String text) { StatusInfo status = new StatusInfo(); if (text.trim().length() == 0) { status.setError(Messages.PortIsEmpty); } else { try { int value = Integer.parseInt(text); if (value < 1000 || value > 65535) { status.setError( MessageFormat.format(Messages.PortShouldBeInRange, new Object[] {text})); } } catch (NumberFormatException e) { status.setError(MessageFormat.format(Messages.PortShouldBeInRange, new Object[] {text})); } } return status; }
public IStatus validate(String text) { StatusInfo status = new StatusInfo(); if (text.trim().length() == 0) { status.setError(Messages.PositiveNumberIsEmpty); } else { try { int value = Integer.parseInt(text); if (value < 0) { status.setError( MessageFormat.format(Messages.PositiveNumberIsInvalid, new Object[] {text})); } } catch (NumberFormatException e) { status.setError( MessageFormat.format(Messages.PositiveNumberIsInvalid, new Object[] {text})); } } return status; }