ICelleditor: show error and do not allow to loose focus until valid data is inserted [message #941513] |
Fri, 12 October 2012 11:48  |
Eclipse User |
|
|
|
Hi.
I'm implementing a tableviewer and two buttons to add and remove records.
Using Jface emf.edit databinding, I'm also implementing editing support for each field. for that I defined textcelleditors and Icelleditorvalidator.
My problem is: I want the user not exiting the editor until he inserted valid data, and When he is trying to exit and data is invalid I want to show an error messagebox.
Is this possible ?
I almost managed to do some of these things (with listener), however there exists always some where I stumble upon:
-listener.applyeditorvalue is called twice when exiting editor.
-listener.editorValuechange is called on each change
But I think the problem is around lostfocus event.
Is there any way to implement this?
Thanks in advance.
|
|
|
Re: ICelleditor: show error and do not allow to loose focus until valid data is inserted [message #1001325 is a reply to message #941513] |
Wed, 16 January 2013 08:42   |
Eclipse User |
|
|
|
Hi,
I'm facing the same problem:
final TextCellEditor textCellEditor = new TextCellEditor(table, SWT.NONE);
textCellEditor.addListener(new ICellEditorListener() {
@Override
public void applyEditorValue()
{
if (notOk) ErrorDialog.openError(null, "Error", "Problem", new Status(IStatus.WARNING, "foo", "Error."));
}
@Override
public void cancelEditor() {
}
@Override
public void editorValueChanged(boolean arg0, boolean arg1) {
}
});
applyEditorValue get's called twice, and the user needs to call the Errormessage twice (I do not have the problem if I do not display the ErrorDialog).
Any suggestion welcome (I'm using Eclipse 4.2.1).
Bernard.
|
|
|
|
Powered by
FUDForum. Page generated in 0.32827 seconds