Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337665 - [Contributions] org.eclipse.ui.internal.PopupMenuExtender does not load all contributions after a registry modification
Summary: [Contributions] org.eclipse.ui.internal.PopupMenuExtender does not load all c...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-20 11:04 EST by idelvall CLA
Modified: 2016-11-10 13:17 EST (History)
4 users (show)

See Also:


Attachments
Eclipse project to reproduce (7.66 KB, application/zip)
2011-02-20 11:54 EST, idelvall CLA
no flags Details
Prososed patched source (19.00 KB, text/plain)
2011-02-22 16:43 EST, idelvall CLA
igdevaal: review?
Details
Proposed patch (1.34 KB, patch)
2011-02-23 17:25 EST, idelvall CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description idelvall CLA 2011-02-20 11:04:48 EST
Build Identifier: 3.2 to current

Only one context menu contribution is updated after a registry mofication event received.

Reproducible: Always
Comment 1 idelvall CLA 2011-02-20 11:54:47 EST
Created attachment 189364 [details]
Eclipse project to reproduce
Comment 2 idelvall CLA 2011-02-20 11:59:40 EST
The attached plugin example makes contributions to popupmenu of any text based editor, adding statically a node named BUG_EXAMPLE_STATIC_NODE,
and programatically a node named BUG_EXAMPLE_DYNAMIC_NODE. 
Since registry modification is being performed on activator startup (previous to any human interaction), the editor has to be already opened from a previous workbench session.
Try with java editor.
Comment 3 idelvall CLA 2011-02-20 12:00:38 EST
Useful breakpoints:
	PopupMenuExtender.registryChanged(IRegistryChangeEvent)
	PopupMenuExtender.readStaticActionsFor(String)
Comment 4 idelvall CLA 2011-02-20 12:01:38 EST
After a matching registry delta modification receiver, viewercontributions made to ext point org.eclipse.ui.popupMenus are lost, and the part needs to be reopened.

Only one undeterminated context menu is updated after a registry mofication event received (the first element in staticActionBuilders.keySet().iterator())
Comment 5 idelvall CLA 2011-02-22 16:43:38 EST
Created attachment 189548 [details]
Prososed patched source

Proposed patch to PopupMenuExtender 1.47.

As I undestand the problem occurs in menu showing: stack menuAboutToShow->readStaticActions()->readStaticActions(String)

Condition in line 465 only is valid for the first menu call, since once it is passed, bitSet value is modified.
Proposed implementation carries out statement in line 469 in order to execute readStaticActions() without changing bitSet value.
The rest of readStaticActions(String) references are updated accordingly, in order to avoid side effects.
Comment 6 Dani Megert CLA 2011-02-23 02:39:40 EST
I didn't look at the patch but when tackling this bug, one must carefully look not to impact performance for other scenarios.
Comment 7 idelvall CLA 2011-02-23 05:13:02 EST
Completely agreed.
The method and bitset attribute are private so that make things easier. 
Changes are straightforward if you compare both codes.
Regards
Comment 8 Paul Webster CLA 2011-02-23 08:31:30 EST
Thanx for the suggested changes, we'll have a look.

Just FYI, that's not a patch, just a file.  Have a look at http://wiki.eclipse.org/Platform_UI/How_to_Contribute

PW
Comment 9 idelvall CLA 2011-02-23 10:21:14 EST
Thanks for the info
Comment 10 idelvall CLA 2011-02-23 17:25:25 EST
Created attachment 189657 [details]
Proposed patch
Comment 11 Daniel Rolka CLA 2013-09-25 10:23:38 EDT
(In reply to idelvall from comment #1)
> Created attachment 189364 [details]
> Eclipse project to reproduce

Unfortunately the application is incomplete (missing class). After fixing it I was able to launch it however I'm not sure if I understand the issue.
Could you please prepare better example demonstrating the issue (running the current example I always get two context menu items, the static and the dynamic one) and describe the steps needed to reproduce it.

thanks in advance for help,
Daniel
Comment 12 Mickael Istria CLA 2016-11-10 13:17:06 EST
Action, popupMenus and viewerContribution extensions are deprecated in favor of org.eclipse.ui.commands/org.eclipse.ui.menus. No work will be planned about actions.