Skip to content

Evaluate visibleWhen expressions for "Show in" menu#3989

Merged
laeubi merged 1 commit intoeclipse-platform:masterfrom
r-mennig:handle_visible_when_expressions_for_show_in_menu
May 8, 2026
Merged

Evaluate visibleWhen expressions for "Show in" menu#3989
laeubi merged 1 commit intoeclipse-platform:masterfrom
r-mennig:handle_visible_when_expressions_for_show_in_menu

Conversation

@r-mennig
Copy link
Copy Markdown
Contributor

@r-mennig r-mennig commented May 8, 2026

Fixes #3969

Currently, visibleWhen expressions are not evaluated for the "ShowIn"-menu. Because of this problem, entries in the "ShowIn"-menu can be disabled, but cannot be made invisible.

This PR fixes the issue by evaluating visibleWhen expressions before creating the command contribution items for the menu.

This also fixes an existing problem for the "Show in" -> "System explorer" entry. According to the definition of the menu contribution, this entry should be hidden when selecting multiple projects. Currently, it is shown as disabled because the visibleWhen expression of the menu contribution is not evaluated (only the enabledWhen expression of the handler gets evaluated correctly which disables the entry).

image

Menu contribution (in /org.eclipse.ui.ide/plugin.xml):
image

"org.eclipse.ui.ide.showInDefinition" definition (in /org.eclipse.ui.ide/plugin.xml):
image

Handler (in /org.eclipse.ui.ide/plugin.xml):
image

This PR also adds a test case documenting the changed behavior of the "Show in" -> "System explorer" entry

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Test Results

   867 files  +   589     867 suites  +589   51m 39s ⏱️ + 46m 45s
 7 988 tests + 2 076   7 745 ✅ + 1 892  243 💤 +184  0 ❌ ±0 
20 466 runs  +15 579  19 811 ✅ +14 978  655 💤 +601  0 ❌ ±0 

Results for commit d666157. ± Comparison against base commit 25b0279.

@laeubi laeubi merged commit d419bb5 into eclipse-platform:master May 8, 2026
18 checks passed
@laeubi
Copy link
Copy Markdown
Contributor

laeubi commented May 8, 2026

@r-mennig thanks for the fix, looks good to me.

@merks
Copy link
Copy Markdown
Contributor

merks commented May 8, 2026

Great that you added at too! 🏆

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.

Handled Menu Item Contributions to ShowInMenu do not evaluate Visible-When Expression

3 participants