Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Recommended way to use IOutlineTreeProvider.Background
Recommended way to use IOutlineTreeProvider.Background [message #1826900] Mon, 04 May 2020 09:16 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
We noticed that opening an Xtext editor can cause UI freezes due to synchronous outline computation. Next we found the marker interface IOutlineTreeProvider.Background which allows to push outline computation to the background.

Seeing that IOutlineTreeProvider.Background is not added by OutlineTreeProviderFragment2, I wonder if for some reasons this interface is not recommended, or would it make sense to make it the default?

We actually saw a few deadlocks when blindly using IOutlineTreeProvider.Background, but we found that the real culprits where in our own code. Is risk of deadlock one reason why this is not the default?

Does anyone know best practices of using IOutlineTreeProvider.Background without risk of deadlock? For example, in one situation we observed the outline needing the UI thread for creating icons, I don't remember if this surfaced as illegal thread access or used syncExec, thus risking deadlock. Perhaps, background outline requires a specific style of label provider?

Lastly, I wonder what is the relation between Background (since 2.8) and BackgroundOutlineTreeProvider (since 2.4). Which one of these should be preferred nowadays?

Re: Recommended way to use IOutlineTreeProvider.Background [message #1826901 is a reply to message #1826900] Mon, 04 May 2020 09:37 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stephan,

changing the default to background would have been a breaking change, that's why it's still only an opt-in. Existing clients would run into the problems that you faced: Rather than working with image descriptors, default impl work with images directly which do need a UI thread.
The Xtend outline implementation uses the background tree provider since its early days and we did not see any deadlocks so far.

Best practices: Hard to tell. It's certainly not possible anymore to work with SWT objects directly, e.g all image computation must be based on image descriptors (see IOutlineNode.Extension and AbstractOutlineNode.setImageDescriptor(ImageDescriptor)).

I hope this helps
Sebastian
Re: Recommended way to use IOutlineTreeProvider.Background [message #1826909 is a reply to message #1826901] Mon, 04 May 2020 12:43 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Compatibility is a very good reason, indeed.
Thanks for the hint about the Xtend implementation.
I think we can work it out from here.

thanks,
Stephan
Previous Topic:Illegal reflective access operation has occurred (guice3.0)
Next Topic:Serialization of unordered, optional attributes
Goto Forum:
  


Current Time: Fri Apr 26 15:09:18 GMT 2024

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

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

Back to the top