Community
Participate
Working Groups
When a popup menu is registered in a Part (in the @PostConstruct method) and the part opens the first time, the menu shows up and everthing is as it should be. If you close the part and open it again (To be Rendered flag set to false and again to true) - the same code is called but the menu does not show up anymore. Perhaps something is not de-registered correctly when your view is closed. Tested and reproduced with: Version: 4.2.0 Build id: I20120315-1300
Created attachment 213222 [details] bug Demo Project Little Project to demonstrate the Problem Open Application - > Click on Label : Popup shows up close View File->Open : Page opens again Click on Label : Popup does not show up anymore
*** Bug 374229 has been marked as a duplicate of this bug. ***
The pushmenu in the second case actually IS in the model and doesn't render. If you call part.getMenus().get(0).toString() in both cases in the first on you see ....widget: Menu {pushme}.... and the second widget: Menu{}... Also if you set the application to remember its state and close it after you have closed the part, you will notice that when you run your app again and open the part for the first time the menu IS displayed. I believe this shows that the closing of the part, or specifically the setting false of the visibility of the part somehow prevents the renderer from displaying it again.
I can share some debug information. Let's have a look at MenuManagerRendere.processHandledItem(...) void processHandledItem(MenuManager parentManager, MHandledMenuItem itemModel) { IContributionItem ici = getContribution(itemModel); if (ici != null) { return; } final IEclipseContext lclContext = getContext(itemModel); HandledContributionItem ci = ContextInjectionFactory.make( HandledContributionItem.class, lclContext); ci.setModel(itemModel); ci.setVisible(itemModel.isVisible()); addToManager(parentManager, itemModel, ci); linkModelToContribution(itemModel, ci); } .... public IContributionItem getContribution(MMenuElement model) { return modelToContribution.get(model); } When it is invoked for the first time to generate Menu widget from Model, method getContribution(itemModel) return null and items are generated correctly. This method checks if model item already has a corresponding UI item. When processHandledItem is invoked for the second time, after part has been closed (Menu widget was disposed). Then getContribution returns not null and no MenuItems created. So the root of the issue it that modelToContribution is not cleaned in time when Menu Disposed. It means clearModelToContribution(..) is not called (or called unproperly) public void clearModelToContribution(MMenuElement model, IContributionItem item) { modelToContribution.remove(model); contributionToModel.remove(item); }
Is there allready a schedule for this to fix on a Milestone? If we can help something let us know...
No one has had a chance to look at this yet, as comment #4 mentioned something must not be cleaning up on the dispose. PW
This is a pretty bad bug. Eclipse is built to be working with windows that can be moved around and closed / reopened. If the menus for a part disappear, for the user it is then impossible to interact with it. In my humble opinion this issue should get a higher priority.
See http://wiki.eclipse.org/Platform_UI/How_to_Contribute if someone would like to take a crack at a patch. PW
Created attachment 229488 [details] Proposed patch Just doing removeGui on the popup menu is not enough as a clean up step. Additional cleaning is required.
Patch in Gerrit https://git.eclipse.org/r/11742 PW
*** Bug 406058 has been marked as a duplicate of this bug. ***
Hi, would it be possible to apply this patch for the next milestone? There there something open to help with? Regards Jonas
(In reply to Jonas Helming from comment #12) > Hi, > would it be possible to apply this patch for the next milestone? There there > something open to help with? There are outstanding comments on the Gerrit review. PW
(In reply to Paul Webster from comment #13) > (In reply to Jonas Helming from comment #12) > > Hi, > > would it be possible to apply this patch for the next milestone? There there > > something open to help with? > > There are outstanding comments on the Gerrit review. > > PW Gerrit updated with new patchset. Can we squeeze this in M4?
(In reply to Sopot Cela from comment #14) > > Gerrit updated with new patchset. Can we squeeze this in M4? Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=4765bf418d00ccbe40662c4d57015305985e95c9 PW
(In reply to Paul Webster from comment #15) This commit broke context menus in the EGit view. I only see the "Show In >" menu now. When I revert this commit, the other menu items are back.
(In reply to Markus Keller from comment #16) > (In reply to Paul Webster from comment #15) > This commit broke context menus in the EGit view. I only see the "Show In >" > menu now. When I revert this commit, the other menu items are back. I'm not sure why the compat layer calls cleanUp on Eclipse startup. This is the stack which causes the removal of the menu items. Investigating. Thread [main] (Suspended (breakpoint at line 436 in MenuManagerRenderer)) MenuManagerRenderer.cleanUp(MMenu) line: 436 PopupMenuExtender.cleanUpContributionCache() line: 488 PopupMenuExtender.createModelFor(String) line: 186 PopupMenuExtender.<init>(String, MenuManager, ISelectionProvider, IWorkbenchPart, IEclipseContext, boolean) line: 156 PartSite.registerContextMenu(String, MenuManager, ISelectionProvider, boolean, IWorkbenchPart, IEclipseContext, Collection) line: 131 ViewSite(PartSite).registerContextMenu(String, MenuManager, ISelectionProvider) line: 508 ViewSite(PartSite).registerContextMenu(MenuManager, ISelectionProvider) line: 516 RepositoriesView.createEmptyArea(Composite) line: 262 RepositoriesView.createPartControl(Composite) line: 354 CompatibilityView(CompatibilityPart).createPartControl(IWorkbenchPart, Composite) line: 138 CompatibilityView.createPartControl(IWorkbenchPart, Composite) line: 155 CompatibilityView(CompatibilityPart).create() line: 319 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available MethodRequestor.execute() line: 56 InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 877 InjectorImpl.processAnnotated(Class<Annotation>, Object, Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier, ArrayList<Class<?>>) line: 857 InjectorImpl.inject(Object, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 119 InjectorImpl.internalMake(Class<?>, PrimaryObjectSupplier, PrimaryObjectSupplier) line: 333 InjectorImpl.make(Class<T>, PrimaryObjectSupplier) line: 254 ContextInjectionFactory.make(Class<T>, IEclipseContext) line: 162 ReflectionContributionFactory.createFromBundle(Bundle, IEclipseContext, IEclipseContext, URI) line: 102 ReflectionContributionFactory.doCreate(String, IEclipseContext, IEclipseContext) line: 71 ReflectionContributionFactory.create(String, IEclipseContext) line: 53 ContributedPartRenderer.createWidget(MUIElement, Object) line: 129 PartRenderingEngine.createWidget(MUIElement, Object) line: 949 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 633 PartRenderingEngine$6.run() line: 526 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 511 ElementReferenceRenderer.createWidget(MUIElement, Object) line: 61 PartRenderingEngine.createWidget(MUIElement, Object) line: 949 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 633 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 StackRenderer.showTab(MUIElement) line: 1208 StackRenderer(LazyStackRenderer).postProcess(MUIElement) line: 96 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 649 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 67 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 67 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 PerspectiveRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 67 PerspectiveRenderer.processContents(MElementContainer<MUIElement>) line: 59 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 PerspectiveStackRenderer.showTab(MUIElement) line: 103 PerspectiveStackRenderer(LazyStackRenderer).postProcess(MUIElement) line: 96 PerspectiveStackRenderer.postProcess(MUIElement) line: 77 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 649 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 67 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 WBWRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 67 WBWRenderer.processContents(MElementContainer<MUIElement>) line: 582 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 645 PartRenderingEngine.safeCreateGui(MUIElement) line: 735 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 706 PartRenderingEngine$7.run() line: 700 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 685 PartRenderingEngine$9.run() line: 1042 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 997 E4Workbench.createAndRunUI(MApplicationElement) line: 146 Workbench$5.run() line: 613 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 567 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 150 IDEApplication.start(IApplicationContext) line: 124 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 109 EclipseAppLauncher.start(Object) line: 80 EclipseStarter.run(Object) line: 372 EclipseStarter.run(String[], Runnable) line: 226 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available Main.invokeFramework(String[], URL[]) line: 636 Main.basicRun(String[]) line: 591 Main.run(String[]) line: 1450 Main.main(String[]) line: 1426
This does not happen on Patchset 4 in Gerrit
(In reply to Sopot Cela from comment #18) > This does not happen on Patchset 4 in Gerrit OK, shall I revert the current fix from the Gerrit change, and then can you re-push patchset 4 up and we'll review it again? PW
Maybe it's easier if I send a gerrit request which just updates the actual code in the repository (remove unlink from cleanup and add it in the event handler) ?
Sure, that works to. PW
https://git.eclipse.org/r/18617
(In reply to Sopot Cela from comment #22) > https://git.eclipse.org/r/18617 Released as http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=c302e42d5a2f3a406622515de3fb2b33ddfa838e Thanks Sopot. PW
Resolving.
Verified in 4.4.0.I20131211-2000