Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid UI access in async viewers which operate on non UI threads #710 #713

Draft
wants to merge 3 commits into
base: R4_29_maintenance
Choose a base branch
from

Conversation

jonahgraham
Copy link
Contributor

(Backport of #712 for the 4.29 branch)

The AsynchronousViewer class hierarchy reuses the Viewer interface but adds additional constraints on it, in particular it allows many of its methods to be called from non-UI threads.

See javadoc summary:

* A viewer that retrieves labels and content asynchronously via adapters and supports
* duplicate elements in the viewer. Retrieving content and labels asynchronously allows
* for arbitrary latency without blocking the UI thread.
* <p>
* This viewer uses adapters to retrieve labels and content rather than
* a label provider and content provider. As such, the label provider for this viewer
* is <code>null</code> by default. The content provider returned by this viewer is
* non-<code>null</code> to conform to the viewer specification, but performs no
* useful function.
* </p>
* <p>
* The selection in this viewer is also set asynchronously. When the selection is set,
* the viewer attempts to perform the selection. If the elements in the specified selection
* are not yet in the viewer, the portion of the selection that could not be honored
* becomes a pending selection. As more elements are added to viewer, the pending selection
* is attempted to be set.

Commit 3b9c02c added UI access to method that used to not have any, therefore this patch restores that non-UI implementation locally consistent with other methods in the async viewer that operate on the model.

Fixes #710

@jonahgraham
Copy link
Contributor Author

It looks like there is some housekeeping needed on the branch before I can get a clean build. If someone is happy to merge this change as is that would be great. Otherwise I may try to find the time.

While the related PR doesn't relate to this code it seems that
the contents of this bundle means a version bump is always
needed
…pse-platform#710

The AsynchronousViewer class hierarchy reuses the Viewer interface
but adds additional constraints on it, in particular it allows many
of its methods to be called from non-UI threads.

See javadoc summary:

https://github.com/eclipse-platform/eclipse.platform/blob/e92b72761b8543358ba9811ea49807f75e98bad5/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/AsynchronousViewer.java#L57-L72

Commit 3b9c02c added UI access to method
that used to not have any, therefore this patch restores that non-UI
implementation locally consistent with other methods in the async viewer
that operate on the model.

Fixes eclipse-platform#710
@jonahgraham jonahgraham marked this pull request as draft September 22, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant