Beispiel #1
0
 public IStatus validate(String text) {
   StatusInfo status = new StatusInfo();
   if (text.trim().length() == 0) {
     status.setError(Messages.FieldIsEmpty);
   }
   return status;
 }
Beispiel #2
0
    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;
    }
Beispiel #3
0
    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;
    }
Beispiel #4
0
    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;
    }