Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » [DATABINDING] Race Condition with Key Board Commit on Linux
[DATABINDING] Race Condition with Key Board Commit on Linux [message #1102262] Thu, 05 September 2013 15:15 Go to next message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
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 12:09 Go to previous message
Dirk Hoffmann is currently offline Dirk HoffmannFriend
Messages: 163
Registered: July 2009
Senior Member
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
Previous Topic:Problem compiling JFace snippet
Next Topic:how to get tableitem by obj in tableviewer
Goto Forum:
  


Current Time: Sun Dec 21 02:51:39 GMT 2014

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

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