| Summary: | [Contributions] visibleWhen and checkenabled=true not working correctly in menu | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Markus Krüger <webmaster> | ||||||
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | pwebster, remy.suen, robin, webmaster | ||||||
| Version: | 3.7.1 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | stalebug | ||||||||
| Attachments: |
|
||||||||
|
Description
Markus Krüger
Created attachment 210162 [details]
RCP project showing the bug.
The visibleWhen/@checkEnabled=true currently depends on the SWT.Show (menuAboutToShow) event, or the notion that it can be updated dynamically. But when it is the only item there and it disabled, the menu is empty and there will be no show event. That's why having one command in the menu that's always visible allows it to work. The dynamic contribution forces updating of the MenuManager at frequent intervals, and that's why having the empty dynamic contribution in the menu also works. Perhaps the enabled state can force a menu manager update. PW Are we doing something wrong than, or is this a bug in eclipse as the attached plugin rcp shows? (In reply to comment #3) > Are we doing something wrong than, or is this a bug in eclipse as the attached > plugin rcp shows? It's a bug. PW Created attachment 210227 [details]
New application action bar advisor for attached project
I found a third workaround which seems to solve the problem in the test project.
The new application action bar advisor registers a listener that listens on source provider changes and then updates the menu recursively.
I need to test it in our real life application and additionally in our lotus notes integration. Maybe doing the update all the time has some side effects, but I do not know this yet.
If this looks not like a good idea, please let me know.
(In reply to comment #5) > I need to test it in our real life application and additionally in our lotus > notes integration. Maybe doing the update all the time has some side effects, > but I do not know this yet. > > If this looks not like a good idea, please let me know. In general this is probably not the way to go. If you recursively update the menu, it will activate all of the plugins that contribute to the main menu (which is most ui plugins) which will also activate all their core supporting plugins. Other parts of the framework will then load any other contributions as needed since all of their plugins are active. Depending on the number of bundles involved, it's a big performance as well as memory consumption hit. In a small RCP app if it gives the desired results, you would be able to decide if it was necessary or not. I would strongly advise not doing it in any lotus notes integration :-) If you feel you need a workaround (this bug won't be addressed in 3.7.x), I would start with the empty dynamic contribution first. PW Thank you for the input, especially regarding lotus notes. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |