[DATABINDING] Race Condition with Key Board Commit on Linux [message #1102262] |
Thu, 05 September 2013 11:15  |
Eclipse User |
|
|
|
Hi,
given a simple Dialog with a dialog area containing a Composite, an Ok
and a Cancel Button.
The Composite contains a user and a password Text field.
An object of the ConnectionAttributes class serves as the model with
getters and setters for user and password.
The text fields and the model are connected using jface databinding.
The Dialogs buttonPressed method is overridden in order to actually
execute the login procedure.
This works well on Windows no matter if the user clicks the OK button or
justs hits enter when finished with the password.
On Linux however the password is not transferred to the model when the
user commits his changes using the Enter key. Some debugging revealed
that the Dialog.buttonPressed() method is executed before the
ConnectionAttributes.setPassword() method so the login procedure sees a
null password.
There is some asyncExec going on somewhere inside the databinding stuff
that probably causes executing ConnectionAttributes.setPassword() too
late. I tried to flush the event queue with
while (display.readAndDispatch()) {
; // do nothing
}
before starting the login procedure but to no success.
Strangewisely it works if I verify the order of execution using the
debugger. But as soon as the debugger is detached the order is wrong again.
This use case seems so common so I believe there is a simple solution.
Any ideas?
Thanks and regards,
Dirk
|
|
|
Re: [DATABINDING] Race Condition with Key Board Commit on Linux [message #1103130 is a reply to message #1102262] |
Fri, 06 September 2013 08:09  |
Eclipse User |
|
|
|
Hi,
solved the problem on my own:
It wasn't the fault of the data binding. Replacing the data binding with
a listener didn't help.
I found out that the event signaling a focus lost comes after that
signalling the user having hit enter. I Had to change the binding to
listen to modifications.
Dirk
Am 05.09.2013 17:15, schrieb Dirk Hoffmann:
> Hi,
>
> given a simple Dialog with a dialog area containing a Composite, an Ok
> and a Cancel Button.
>
> The Composite contains a user and a password Text field.
>
> An object of the ConnectionAttributes class serves as the model with
> getters and setters for user and password.
>
> The text fields and the model are connected using jface databinding.
>
> The Dialogs buttonPressed method is overridden in order to actually
> execute the login procedure.
>
> This works well on Windows no matter if the user clicks the OK button or
> justs hits enter when finished with the password.
>
> On Linux however the password is not transferred to the model when the
> user commits his changes using the Enter key. Some debugging revealed
> that the Dialog.buttonPressed() method is executed before the
> ConnectionAttributes.setPassword() method so the login procedure sees a
> null password.
>
> There is some asyncExec going on somewhere inside the databinding stuff
> that probably causes executing ConnectionAttributes.setPassword() too
> late. I tried to flush the event queue with
>
> while (display.readAndDispatch()) {
> ; // do nothing
> }
>
> before starting the login procedure but to no success.
>
> Strangewisely it works if I verify the order of execution using the
> debugger. But as soon as the debugger is detached the order is wrong again.
>
> This use case seems so common so I believe there is a simple solution.
>
> Any ideas?
>
> Thanks and regards,
> Dirk
|
|
|
Powered by
FUDForum. Page generated in 0.02985 seconds