Validating input in a TableViewer [message #444948] |
Sat, 25 February 2006 04:52 |
Antonio Gurisatti Messages: 109 Registered: July 2009 |
Senior Member |
|
|
I have a column with a TextCellEditor attached to a column and need to validate users input.
If I use the method found on more than one example, i.e
((Text) lengthEditor.getControl()).addVerifyListener(
new VerifyListener() {
public void verifyText(VerifyEvent e) {
// Here, we could use a RegExp such as the following
// if using JRE1.4 such as e.doit = e.text.matches("[\\-0-9]*");
e.doit = "0123456789".indexOf(e.text) >= 0 ;
}
});
then the label provider get nuts giving wrong values when I click en the same column of a different row.
If I use an ICellEditorValidator (that works perfectly for Properties) I get a message saying "There was an error, for more details look at the error log". I couldn't find an entry in the error log.
So, the workaround I found was to do the required validation in the "CellModifierClass", changing the value only if it is correct. This way, if the input is wrong, it leaves the old value. The only issue is that it doesn't blocks navigation.
Even thought I found this workaround I'm not really satisfied:
I'd like to know if there is a big bug around this or if I am missing something.
Thanks a heap
|
|
|
Powered by
FUDForum. Page generated in 0.03274 seconds