Show Open/Close Project for mixed selections in Project Explorer#3866
Draft
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
Draft
Show Open/Close Project for mixed selections in Project Explorer#3866vogella wants to merge 1 commit intoeclipse-platform:masterfrom
vogella wants to merge 1 commit intoeclipse-platform:masterfrom
Conversation
Contributor
f1075f2 to
05018be
Compare
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
05018be to
e1e0229
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.
The
ResourceMgmtActionProviderenablement expression required all selected elements to adapt toIResourceorIWorkingSet. 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 asUndoRedoActionProvider). The existingfillContextMenu()logic viaselectionToProjects()already filters to applicable projects and only shows relevant actions — no behavioral change for pure-project selections.Fixes #3790