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());
snippet code in my part to register popupmenu
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.