Time for action – creating warning and error messages

In free-form text fields, it's sometimes possible to enter a value that isn't valid. For example, when asking for an e-mail address, it might be necessary to validate it against some kind of regular expression such as .+@.+ to provide a simple check.

  1. To test the default validation, run the target Eclipse instance and go to the Clock preference page. Type some text in the numeric field. A warning message, Value must be an integer, will be displayed:
    Time for action – creating warning and error messages
  2. To add validation, create a new field called offset that allows values between -14 and +12 (by default, IntegerFieldEditor validates against the 0..MAX_INT ...

Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.