Skip to content

Add IStructuredSelection.toList(Class) for typed selection access - #4579

Open
vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:issue-1376-typed-selection-list
Open

vogella wants to merge 1 commit into
eclipse-platform:masterfrom
vogella:issue-1376-typed-selection-list

Conversation

@vogella

@vogella vogella commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Getting the selected elements of a specific type out of an IStructuredSelection currently needs a raw-type cast or a stream().filter(...).map(...) chain at every call site. This adds a default toList(Class) method that returns the selected elements of the given type, in selection order, as an unmodifiable List, so callers can write viewer.getStructuredSelection().toList(IResource.class). Since it is a default method, existing implementations pick it up without changes.

Fixes #1376

Returns the selected elements of the given type as an unmodifiable list, replacing the common filter and cast stream idiom.

Fixes eclipse-platform#1376

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

   578 files   -   289     578 suites   - 289   29m 11s ⏱️ - 21m 48s
 8 548 tests ±    0   8 300 ✅  -     8  248 💤 +  8  0 ❌ ±0 
14 344 runs   - 7 172  13 888 ✅  - 6 955  456 💤  - 217  0 ❌ ±0 

Results for commit abc0ead. ± Comparison against base commit b5dd338.

This pull request skips 8 tests.
org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelperTest ‑ testGetFontDataWithIntermediateWeightDescribesThePangoWeight
org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelperTest ‑ testGetFontDataWithRegularOrBoldWeightKeepsThePortableFont
org.eclipse.e4.ui.tests.css.swt.LabelTest ‑ testFontWeightSelectsThePangoWeightOnGtk
org.eclipse.ui.genericeditor.tests.HoverTest ‑ testEnabledWhenHover(TestInfo)
org.eclipse.ui.genericeditor.tests.HoverTest ‑ testMultipleHover(TestInfo)
org.eclipse.ui.genericeditor.tests.HoverTest ‑ testProblemHover(TestInfo)
org.eclipse.ui.genericeditor.tests.HoverTest ‑ testSingleHover(TestInfo)
org.eclipse.ui.genericeditor.tests.ShowInformationTest ‑ testInformationControl(TestInfo)

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.

Option to get the StructuredSelection as a typed list

1 participant