Bug 538806

Summary: Some (a)syncExec(Supplier<T> provider) in Display class
Product: [Eclipse Project] Platform Reporter: Mickael Istria <mistria>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: akurtakov, ericwill, loskutov, xixiyan
Version: 4.8   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mickael Istria CLA 2018-09-07 13:24:40 EDT
Display a/syncExec method require runnable. However, there can be numerous cases where we're using it to retrieve some UI values. In such case, it would be great to have the methods taking as input a Supplier to let it return a typed object.
Comment 1 Alexander Kurtakov CLA 2019-02-08 04:15:21 EST
Can you give a sample snippet how do you imagine it ?
Comment 2 Mickael Istria CLA 2019-02-08 04:23:34 EST
From non-UI Thred: Color backgroundColor = control.getDisplay().asyncExec(() -> control.getBackground());
Comment 3 Andrey Loskutov CLA 2019-02-08 04:29:33 EST
(In reply to Mickael Istria from comment #2)
> From non-UI Thred: Color backgroundColor = control.getDisplay().asyncExec(()
> -> control.getBackground());

Not sure I can follow. If it waits here and get a Color, it is not an asyncExec(). Or it gets a Future<Color>, but then it needs to call future.get() for the Color and will be again not async.
Comment 4 Mickael Istria CLA 2019-02-08 04:31:03 EST
The Display.syncExec(Supplier<T>) should return a T
The Display.asyncExec(Supplier<T>) should return a CompletableFuture<T>