I met a defect that dynamically created menu items disappear after creating a new viewPart. It caused me overtime last Friday. Today I find the root cause.
The scenario is:
open first document, the items are shown well
open another document, the items disappear
The requirement is that showing the menu items while current part is document, otherwise hide them.
So our implementation is:
when current document part is deactivated, set menu items invisible
when document part is activated, set menu items visible
After debugging, I found that menu items was updated before the part activated listener was notified. Hence the menu is invisible while the parent menu is updated. The resolved solution is that setting menu items visible while part opened listener is notified.