Bug 567152 - [Databinding] Add method to return value from other Realm
Summary: [Databinding] Add method to return value from other Realm
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jens Lideström CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-19 16:06 EDT by Jens Lideström CLA
Modified: 2021-12-29 16:55 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jens Lideström CLA 2020-09-19 16:06:04 EDT
A rather common task is to get the value of an observable that belongs to another realm.

To do this users have to go through an awkward manoeuvre involving a box which is assigned to from a runnable. Example:

IObservableValue<String> o = ...
AtomicReference<String> ref = new AtomicReference<>();
o.getRealm(()  -> ref.set(o.getValue));
String s = ref.get();

We should add a method on Realm that helps with this task, so the code above can be written as follows:

IObservableValue<String> o = ...
String s = o.getRealm().execAndGet(o::getValue);
Comment 1 Jens Lideström CLA 2021-12-28 12:23:54 EST
Work on this stalled when I discovered the complexity with exceptions from the target realm...
Comment 2 Jens Lideström CLA 2021-12-28 12:24:12 EST
SWT added a similar method directly on Display:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=575823