Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » How to show popup menu on customized viewer
How to show popup menu on customized viewer [message #1729042] Sun, 10 April 2016 05:53
محمد هادی منصوری is currently offline محمد هادی منصوریFriend
Messages: 1
Registered: April 2016
Junior Member
hi all
I have problem to show popup menu.
I have a Part that contains a customized viewer, name it MyViewer (extended from org.eclipse.jface.viewers.StructuredViewer). This viewer contains a SWT Composite (MyComposite). This composite contains an AWT component. I use AWT_SWT bridge to add AWT component to the SWT Composite. I add mouse listener to the AWT component and want to display a SWT popup menu when user right click occure on the AWT component.
I have register a popup menu on the my SWT Composite in the part.
I have find following snippet to show a popup menu programmtically. But does not work for me! My mouse listener is called and code snippet is run but popup menu is not shown.

snippet code in MyViewer to add AWT component to SWT compsite:
java.awt.Frame frame = SWT_AWT.new_Frame(myComposite);
java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());
frame.add(panel);


snippet code in my part to register popupmenu
menuService.registerContextMenu(myViewer.getControl(), id);


snippet code to show popup menu programmatically:
myViewer.getControl.getMenu().notifyAllListeners(SWT.Show, new Event());
// I have tested this code also
// myViewer.getControl.notifyAllListeners(SWT.MouseDown, new Event());


Thanks to help me.
Previous Topic:OOTB Eclipse 4 Application wizard "Template option" "Create sample content (parts, me
Next Topic:Pitfalls when command executes another command?
Goto Forum:
  


Current Time: Mon Jun 25 12:23:44 GMT 2018

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

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

Back to the top