What is the Java convention when it comes to user input validation in SWT? I read that there are FieldEditors which are very convenient fields but sadly only for preferences and dialogue boxes.
I also read that there is an IValidator interface. But it is often used with data binding, which is in my case, most of my inputs do not need any data binding yet. Also, IValidator requires me to write my own validation methods even for simple validations such as integer only, letters only, etc.
Since the FieldEditors cannot be applied in normal usage of input fields, what other convenient way can I use to do validation on user inputs? I am using SWT for my Java GUI.
You can validate the input of your control in a VerifyListener. See <a href="http://www.eclipsezone.com/eclipse/forums/t60539.html" rel="nofollow">this forum thread</a> for further explanation.
Alternatively, you can check out <a href="http://marketplace.eclipse.org/content/rcp-toolbox-0" rel="nofollow">RCP Toolbox</a> which has a built-in easy-to-use validation framework. See <a href="http://eclipse.dzone.com/articles/adding-swt-input-validation-ea" rel="nofollow">this</a> article.