|Re: [DataBinding] Have WritableList created in separate init thread, but want SWT default Realm [message #336353 is a reply to message #336347]
||Tue, 09 June 2009 13:11
| Thomas Schindl
Registered: July 2009
Do you have access to the Display or the Workbench? Then you can create
your WritableValue by using syncExec or use the SWTRealm provided to you
> Its a spring dynamic modules/OSGi services example so a snippet may not
> be useful. The OSGi extender that creates application contexts for each
> bundle in its own thread so when the WritableList is created, it tries
> to get Realm.getDefault()which is null for that thread.
> I'll test your idea though by creating a Realm and using it explicitly.
> The only problem is that the initialization thread terminates so I need
> a Realm that is a little smarter somehow than just running in the
> initialization thread (which is not under my control).
> Since spring dm is built on OSGi services, its possible that any
> observable requiring a realm may have this problem if OSGi services are
> started in their own thread versus a thread where the realm has been set
> (such as the UI thread created when the workbench runs).
> Tom Schindl wrote:
>> Could you provide a small example to fully understand your problem. In
>> theory you could simply create your own realm and the SWT-Observables
>> take care that the synchronization is done appropriately when your
>> writable-value changes.
>> Please provide a completely runnable snippet!
>> aappddeevv schrieb:
>>> I have an object created in a separate initialization thread. The object
>>> contains a WritableList. Doing a Realm.getDefault() returns null because
>>> the realm has not been set yet on that thread. However, once the object
>>> is initialized, I want the realm to be the default SWT realm that is
>>> created with the workbench because the change events should run on the
>>> UI thread. The object is a model for a UI component and the UI needs to
>>> be updated when the model changes.
>>> How can I create an observable, perhaps with a dummy realm on one
>>> thread, but then use the realm from the workbench/SWT? Do I need to use
>>> a realm proxy or delegate of some sort?
Powered by FUDForum
. Page generated in 0.02440 seconds