views:

51

answers:

1

What is the best way to validate Text, Combo and any other SWT widget included in Eclipse Wizard? Recently, I got into a project in which there are many different wizards. I tried to add FocusListeners, ModifyListeners etc. however the size of code and it's complexity was not what I expected.

Let's say there are two Text elements in WizardPage. They both cannot be empty and should contain only small letters. How to write a validator which checks if fields are empty or contain unexpected characters and display an error message in case something went wrong.

The way it has to be done must be sophisticated, elegant and useful.

A: 

I would recommend using JFace databindings (I use them myself). You will be able to add validators to particular binding and automatically show validation errors/warnings in the wizard.

Eugene