Twitter github

JFace Databinding is Cool

I have been getting to know JFace Databinding lately. It was on my TODO list of Eclipse technologies to learn and although things were rough in the beginning, I’m starting really appreciate things. For example, I had a use case where I was binding a value to a text control. By default, the model was being updated on every keystroke which could be fine. However, if you have a complex UI that does fancy validation, it can cause unexpected results like refreshes that you just don’t want. A simple and more natural thing is only to commit a change to the model after the user is done typing instead of every keystroke. The solution in JFace Databinding is simple…

SWTObservables.observeDelayedValue(400, myObservable)

There’s also a nice code snippet that you can run to see how the code works.