Repository navigation
Conversation
Contributor
laeubi
requested changes
Nov 19, 2026
laeubi
left a comment
Contributor
There was a problem hiding this comment.
Why not adding <T> Stream<T> stream(Class<T> type) instead what would allow collection into any type (including toList())?
Otherwise the next one want an generic toArray(), toX ... I though I even have suggested that in the initial design but back then I think @mickaelistria has objected so we ended with a very minimal API.
vogella
force-pushed
the
issue-1376-typed-selection-list
branch
from
December 2, 2026 15:19
abc0ead to
89566a4
Compare
Returns the selected elements that are instances of the given type as a Stream in selection order, replacing the common filter and cast stream idiom and allowing callers to collect into lists, findFirst(), etc. The added default method is binary compatible, so it is filtered like the IStructuredSelection.stream() addition and the bundle version stays a minor bump. Fixes eclipse-platform#1376 Assisted-by: multiple AI agents and layers of automated tooling 🤖
vogella
force-pushed
the
issue-1376-typed-selection-list
branch
from
December 3, 2026 07:40
89566a4 to
1cedc74
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Getting the selected elements of a specific type out of an IStructuredSelection currently needs a raw-type cast or a
stream().filter(type::isInstance).map(type::cast)chain at every call site. This adds a default<T> Stream<T> stream(Class<T> type)method that returns the selected elements of the given type in selection order, so callers can writeviewer.getStructuredSelection().stream(IResource.class).toList(),.findFirst(), or collect into any target type.Since it is a default method, existing implementations pick it up without changes.
AbstractSelectionDialog.setResult(ISelection, Class)is simplified to use it as well.Fixes #1376