Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Disposed control causes that popup menu stops working(When same popup menu is registered to more controls, it stops working while one of the controls is disposed)
Disposed control causes that popup menu stops working [message #1267922] Sun, 09 March 2014 20:22 Go to next message
Martin Bayer is currently offline Martin Bayer
Messages: 26
Registered: December 2012
Junior Member
Hi,
today I found something what seems to be quite weird to me.
I created popup menu in my Application model for one of my parts. Menu's ID is cz_martinbayer_e4_analyser_processor_popup_menu.
My implementation provides the adding of my own Controls to the canvas so when I create a Control, I register popup menu for it in the constructor with:
menuService.registerContextMenu(this,'cz_martinbayer_e4_analyser_processor_popup_menu');

When I create few such controls, I'm able to display the popup menu for all of them by right mouse, but when I dispose one of created controls, I'm not able to display popup menu any more for any of the remaining controls.
Do I use it in a bad way or does it look like a bug?
Thanks,

Martin
Re: Disposed control causes that popup menu stops working [message #1277674 is a reply to message #1267922] Wed, 26 March 2014 09:55 Go to previous messageGo to next message
Sopot Cela is currently offline Sopot Cela
Messages: 597
Registered: December 2010
Senior Member

This was a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=375393
Try the latest builds and see if you can reproduce it.
Re: Disposed control causes that popup menu stops working [message #1279144 is a reply to message #1277674] Fri, 28 March 2014 09:45 Go to previous message
Martin Bayer is currently offline Martin Bayer
Messages: 26
Registered: December 2012
Junior Member
Hi,
I just tried it and still not working. I checked my local MenuManagerRenderer to be sure I'm using fixed version and it contains changes in toBeRenderedUpdater event handler.
I'm sharing more source code for you to explain the situation better. The difference between bug you mentioned and my problem is that in bug, the context menu was registered to the part. I have following situation:
I created new control:
public class CanvasProcessorItem extends Composite
...
public CanvasProcessorItem(Composite parent, int style,
	ProcessorPaletteItem selectedObject, EMenuService menuService,
	IEclipseContext context, int neededImageHeight, int neededImageWidth) {
	super(parent, style | SWT.BORDER);
	...
	initPopupMenu(menuService);
        ...
}
private void initPopupMenu(EMenuService menuService) {
        menuService.registerContextMenu(this,ContextVariables.ITEM_POPUP_MENU_ID);
}

where ContextVariables.ITEM_POPUP_MENU_ID is the identifier for popup menu...
I can see I described my problem completely wrong (because menu is not registered for the part) so I'm really sorry for that...
Thank you and wish you nice day...
Previous Topic:org.eclipse.e4.tools.emf.editor.ModelEditor commands not executable
Next Topic:Why is org.eclipse.e4.core.services.adapter.Adapter restricted?
Goto Forum:
  


Current Time: Mon Sep 22 22:34:41 GMT 2014

Powered by FUDForum. Page generated in 0.01627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software