Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [DataBinding] SWT Event Dispatch Thread Synchronization for TextObservableValue - gone?
[DataBinding] SWT Event Dispatch Thread Synchronization for TextObservableValue - gone? [message #447686] Wed, 12 April 2006 12:40 Go to next message
Eclipse UserFriend
As it seems the synchronized access for widgets using the previously
available SyncRunnable/AsyncRunnable classes is no longer implemented.
Therefore the application code is now responsible for a correct behavior
(i.e. the model may only be updated in the event dispatch thread to
avoid invalid thread access exceptions).

Will this behavior remain in the future of the databinding and do I
therefore don't have to implement synchronization code within my own UI
based Observables?

Thank you for your suggestions
Rainer


Code taken from the outdated TextUpdatableValue:
......

public void setValue(final Object value) {

AsyncRunnable runnable = new AsyncRunnable(){
public void run(){
String oldValue = text.getText();
try {
updating = true;
bufferedValue = (String)value;
text.setText(value == null ? "" : value.toString());
} finally {
updating = false;
}
fireChangeEvent(ChangeEvent.CHANGE, oldValue, text.getText());

}
};
runnable.runOn(text.getDisplay());
}

public Object computeValue() {
SyncRunnable runnable = new SyncRunnable(){
public Object run() {
return text.getText();
}
};
return runnable.runOn(text.getDisplay());
}
Re: [DataBinding] SWT Event Dispatch Thread Synchronization for TextObservableValue - gone? [message #447775 is a reply to message #447686] Sat, 15 April 2006 00:35 Go to previous messageGo to next message
Eclipse UserFriend
We had removed this code because we realized that our thread
synchronization story was broken. We would automatically synchronize
with the UI thread if some other thread called us, but we had/have no
way to synchronize with the other thread when we need to call to an
Observable that wants to run on another thread.

So our current threading story is that we only support running on the UI
thread if you're binding to SWT and that your code needs to synchronize
with the UI thread before calling us.

We know that stinks. But there wasn't time before API freeze in M5 to
think of anything better. Which is why we decided to release as
provisional API--so we could fix this when we get feedback about what
works and what doesn't from other folks who are using data binding.

Hope this helps!


Best regards,

Dave Orme

Rainer Lang wrote:
> As it seems the synchronized access for widgets using the previously
> available SyncRunnable/AsyncRunnable classes is no longer implemented.
> Therefore the application code is now responsible for a correct behavior
> (i.e. the model may only be updated in the event dispatch thread to
> avoid invalid thread access exceptions).
>
> Will this behavior remain in the future of the databinding and do I
> therefore don't have to implement synchronization code within my own UI
> based Observables?
>
> Thank you for your suggestions
> Rainer
>
>
> Code taken from the outdated TextUpdatableValue:
> .....
>
> public void setValue(final Object value) {
>
> AsyncRunnable runnable = new AsyncRunnable(){
> public void run(){
> String oldValue = text.getText();
> try {
> updating = true;
> bufferedValue = (String)value;
> text.setText(value == null ? "" : value.toString());
> } finally {
> updating = false;
> }
> fireChangeEvent(ChangeEvent.CHANGE, oldValue, text.getText());
> }
> };
> runnable.runOn(text.getDisplay());
> }
>
> public Object computeValue() {
> SyncRunnable runnable = new SyncRunnable(){
> public Object run() {
> return text.getText();
> }
> };
> return runnable.runOn(text.getDisplay());
> }


--
Visual Editor Project lead
http://www.coconut-palm-software.com
http://www.db4o.com -- The Open-source Java Object Database
Re: [DataBinding] SWT Event Dispatch Thread Synchronization for TextObservableValue - gone? [message #448238 is a reply to message #447775] Wed, 19 April 2006 13:45 Go to previous message
Eclipse UserFriend
Yes, thank you for the explanation.

Kind regards, Rainer

David J. Orme wrote:
> We had removed this code because we realized that our thread
> synchronization story was broken. We would automatically synchronize
> with the UI thread if some other thread called us, but we had/have no
> way to synchronize with the other thread when we need to call to an
> Observable that wants to run on another thread.
>
> So our current threading story is that we only support running on the UI
> thread if you're binding to SWT and that your code needs to synchronize
> with the UI thread before calling us.
>
> We know that stinks. But there wasn't time before API freeze in M5 to
> think of anything better. Which is why we decided to release as
> provisional API--so we could fix this when we get feedback about what
> works and what doesn't from other folks who are using data binding.
>
> Hope this helps!
>
>
> Best regards,
>
> Dave Orme
>
> Rainer Lang wrote:
>> As it seems the synchronized access for widgets using the previously
>> available SyncRunnable/AsyncRunnable classes is no longer implemented.
>> Therefore the application code is now responsible for a correct
>> behavior (i.e. the model may only be updated in the event dispatch
>> thread to avoid invalid thread access exceptions).
>>
>> Will this behavior remain in the future of the databinding and do I
>> therefore don't have to implement synchronization code within my own
>> UI based Observables?
>>
>> Thank you for your suggestions
>> Rainer
>>
>>
>> Code taken from the outdated TextUpdatableValue:
>> .....
>>
>> public void setValue(final Object value) {
>>
>> AsyncRunnable runnable = new AsyncRunnable(){
>> public void run(){
>> String oldValue = text.getText();
>> try {
>> updating = true;
>> bufferedValue = (String)value;
>> text.setText(value == null ? "" : value.toString());
>> } finally {
>> updating = false;
>> }
>> fireChangeEvent(ChangeEvent.CHANGE, oldValue, text.getText());
>> }
>> };
>> runnable.runOn(text.getDisplay());
>> }
>>
>> public Object computeValue() {
>> SyncRunnable runnable = new SyncRunnable(){
>> public Object run() {
>> return text.getText();
>> }
>> };
>> return runnable.runOn(text.getDisplay());
>> }
>
>
Previous Topic:MasterDetailsBlock - any way to veto details page switch?
Next Topic:Centralized Notification Broadcast in an Eclipse Application
Goto Forum:
  


Current Time: Sun Nov 09 08:50:01 EST 2025

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

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

Back to the top