Skip to content

Show Open/Close Project for mixed selections in Project Explorer#3866

Draft
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:fix/issue-3790-open-close-mixed-selection
Draft

Show Open/Close Project for mixed selections in Project Explorer#3866
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella:fix/issue-3790-open-close-mixed-selection

Conversation

@vogella
Copy link
Copy Markdown
Contributor

@vogella vogella commented Apr 5, 2026

The ResourceMgmtActionProvider enablement expression required all selected elements to adapt to IResource or IWorkingSet. This hid Open/Close Project actions when the selection contained non-resource elements (e.g., working set headers from Ctrl+A).

Changed the enablement to always activate the provider (using <or/>, the same pattern as UndoRedoActionProvider). The existing fillContextMenu() logic via selectionToProjects() already filters to applicable projects and only shows relevant actions — no behavioral change for pure-project selections.

Fixes #3790

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Test Results

0 files   -    852  0 suites   - 852   0s ⏱️ - 1h 0m 1s
0 tests  -  7 894  0 ✅  -  7 651  0 💤  - 243  0 ❌ ±0 
0 runs   - 20 184  0 ✅  - 19 529  0 💤  - 655  0 ❌ ±0 

Results for commit e1e0229. ± Comparison against base commit f22f75c.

♻️ This comment has been updated with latest results.

@vogella vogella force-pushed the fix/issue-3790-open-close-mixed-selection branch 3 times, most recently from f1075f2 to 05018be Compare April 13, 2026 17:35
Ctrl+A in an expanded Project Explorer produces a mixed selection:
projects, child files/folders, and non-adaptable elements such as
working set headers. Three problems combined to hide the Open/Close
Project actions in that case:

1. The ResourceMgmtActionProvider enablement expression required ALL
   selected elements to adapt to IResource or IWorkingSet, so the
   provider was never activated for mixed selections. Fixed by replacing
   the expression with <or/> to always activate the provider.

2. CloseResourceAction and OpenResourceAction.updateSelection() called
   selectionIsOfType(PROJECT), which returns false whenever any
   non-IResource element (e.g. a working set header) is present in the
   selection, even if every resource element is a valid open/closed
   project. Fixed by checking getSelectedResources() directly.

3. CloseUnrelatedProjectsAction.resourceChanged() had the same
   selectionIsOfType guard, preventing the action from reacting to
   project state changes for mixed selections. Fixed analogously.

ResourceMgmtActionProvider now overrides getSelectedResources() on the
open/close action instances to filter the selection down to IProject
elements only, so that files and folders selected alongside projects
(expanded Ctrl+A) do not disable the actions.

Fixes eclipse-platform#3790
@vogella vogella force-pushed the fix/issue-3790-open-close-mixed-selection branch from 05018be to e1e0229 Compare April 13, 2026 18:49
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.

Improve Open/Close Project visibility in Project Explorer for mixed selections

1 participant