Bug 563653 - [e4] Missleading Message when make injection for Dynamic Menu Contribution
Summary: [e4] Missleading Message when make injection for Dynamic Menu Contribution
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-28 03:00 EDT by Christoph Laeubrich CLA
Modified: 2020-05-28 04:38 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2020-05-28 03:00:05 EDT
I'm currently playing around with Dynamic Menu Contribution as described here: 
http://blog.vogella.com/2013/03/21/dynamic-menu-contributions-in-eclipse-e4/

But I encountered a serve problem here:
The Method annotated with @AboutToShow can not have additional parameters injected.

This is because an empty IEclipseContext is created and only populated with the item itself and the List of menu items. Then this context is used to call the AboutToShow method.

Because of this it is very hard for the 'Dynamic Menu Contribution' to be really dynamic and contradicts the whole idea of a 'dynamic' contribution if only static values can be used.
Comment 1 Lars Vogel CLA 2020-05-28 03:08:14 EDT
Sounds like this context should be created as child context of the active context. Gerrits are welcome
Comment 2 Christoph Laeubrich CLA 2020-05-28 04:38:29 EDT
@Lars sorry for confusion, while debugging the code more deeply for providing a patch I noticed that in fact everything works quite well... beside that if one tries to inject a wrong item (in my case: interface versus implementation class) a confusing "Missing @AboutToShow method in..." message is emitted what leads me on the wrong track.

Anyways I'll change the ticket to improve this message to something like:

> No suitable @AboutToShow method found for injection in ...

It also seems that even though it is possible with the injector to report missing items this is not used in ContextInjectionFactory :-\