Bug 538806 - Some (a)syncExec(Supplier<T> provider) in Display class
Summary: Some (a)syncExec(Supplier<T> provider) in Display class
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.8   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-07 13:24 EDT by Mickael Istria CLA
Modified: 2019-02-08 04:31 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>