Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Validate text in TextCellEditor after input
Validate text in TextCellEditor after input [message #22419] Tue, 21 July 2009 16:20 Go to next message
Andrei Serea is currently offline Andrei SereaFriend
Messages: 16
Registered: July 2009
Junior Member
Hello all,

Here is my problem: I have a table with a celleditor (textcelleditor)
attached to one of its columns. To this textcelleditor I have also attached
an ICellEditorValidator just to validate the user input.
The problem is that the validator is called when the editor is activated
(when the user first clicks the cell) and not after it presses enter to
finish editing. In other words, the data validated is that which already
existed at the start of the editing process and not the new data just
entered.

Any clues to where I am failing?

Thank you!
Andrei.
Re: Validate text in TextCellEditor after input [message #22509 is a reply to message #22419] Wed, 22 July 2009 12:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bjoern.bjoernfischer.de

Hello Andrei,
maybe you could attach a FocusListener to the TextCellEditor (more
specific: to the Text control you can obtain via
TextCellEditor#getControl()). Then your validation could be executed
when the editor looses its focus.

Regards,
Björn

Andrei Serea schrieb:
> Hello all,
>
> Here is my problem: I have a table with a celleditor (textcelleditor)
> attached to one of its columns. To this textcelleditor I have also attached
> an ICellEditorValidator just to validate the user input.
> The problem is that the validator is called when the editor is activated
> (when the user first clicks the cell) and not after it presses enter to
> finish editing. In other words, the data validated is that which already
> existed at the start of the editing process and not the new data just
> entered.
>
> Any clues to where I am failing?
>
> Thank you!
> Andrei.
>
>
Re: Validate text in TextCellEditor after input [message #22638 is a reply to message #22509] Wed, 22 July 2009 13:09 Go to previous messageGo to next message
Andrei Serea is currently offline Andrei SereaFriend
Messages: 16
Registered: July 2009
Junior Member
Yes, I thought of this and I will probably use this solution.

My question still remains: Why would anyone want the validator to be
called at the activation (begin of edit) of the cell editor and not at the
deactivation (end of edit)? I just cannot understand the use of this...
Maybe someone could help me understand. Or should I look at this as a bug?
Re: Validate text in TextCellEditor after input [message #22681 is a reply to message #22638] Wed, 22 July 2009 13:22 Go to previous message
Eclipse UserFriend
Originally posted by: bjoern.bjoernfischer.de

As far as I can see the cell validator is called on every change in the
cell (and this includes activation). This behaviour might be good if you
want to for example filter for forbidden characters or something like that.

I can not say if this is a bug or not, for me it is just a useless
feature. But since you have full control of the underlying Text widget
it is not difficult to work around (you can e.g. also put the
VerifyListener on the Text widget). Maybe that is also a reason why
nobody puts effort on that topic. An easy workaround makes the "bug"
unimportant.

Regards,
Björn

Andrei Serea schrieb:
> Yes, I thought of this and I will probably use this solution.
>
> My question still remains: Why would anyone want the validator to be
> called at the activation (begin of edit) of the cell editor and not at
> the deactivation (end of edit)? I just cannot understand the use of
> this... Maybe someone could help me understand. Or should I look at this
> as a bug?
>
Previous Topic:Bind TableViewer to Multiple Objects?
Next Topic:[CellEditor] Find the currently active CellEditor in a TableViewer (3.3 API)
Goto Forum:
  


Current Time: Mon Jul 29 21:06:47 GMT 2024

Powered by FUDForum. Page generated in 0.02449 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top