Popup Menu [message #71263] |
Tue, 18 March 2003 10:08 |
Eclipse User |
|
|
|
Originally posted by: OscarMartin.es.ibm.com
Hello everyone
I want to create a popup menu for IFigures inside a big IFigure which is in
a Composite of an IEditorPart
I am doing
MenuManager menuManager = new MenuManager();
Menu menu = menuManager.createContextMenu(fec.getShell());
menuManager.addMenuListener(new IMenuListener() {
/**
* @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(IMenu Manager)
*/
public void menuAboutToShow(IMenuManager manager) {
manager.add()
}
});
menu.addMenuListener(new MenuListener() {
public void menuHidden(MenuEvent e) {
System.out.println("menuHidden");
}
public void menuShown(MenuEvent e) {
System.out.println("menuShown");
}
});
MenuItem menuItem = new MenuItem(menu, SWT.CASCADE);
menuItem.setText("Delete");
menuItem.addSelectionListener(new SelectionListener() {
/**
* @see
org.eclipse.swt.events.SelectionListener#widgetSelected(Sele ctionEvent)
*/
public void widgetSelected(SelectionEvent e) {
System.out.println("widgetSelected");
}
/**
* @see
org.eclipse.swt.events.SelectionListener#widgetDefaultSelect ed(SelectionEven
t)
*/
public void widgetDefaultSelected(SelectionEvent e) {
System.out.println("widgetDefaultSelected");
}
});
menu.setVisible(true);
When the IEditorPart is started I can see on the console
menuAboutToShow
menuShown
menuHidden
but nothing else is displayed and I see no popup menu...
Thanks in advance
|
|
|
|
Re: Popup Menu [message #71379 is a reply to message #71263] |
Tue, 18 March 2003 19:50 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
If you use EditPartViewer.setContextMenu(MenuManager), we will call
Control.setMenu automatically.
"Oscar Martin" <OscarMartin@es.ibm.com> wrote in message
news:b56r2n$a95$1@rogue.oti.com...
> Hello everyone
> I want to create a popup menu for IFigures inside a big IFigure which is
in
> a Composite of an IEditorPart
> I am doing
>
> MenuManager menuManager = new MenuManager();
> Menu menu = menuManager.createContextMenu(fec.getShell());
> menuManager.addMenuListener(new IMenuListener() {
> /**
> * @see
org.eclipse.jface.action.IMenuListener#menuAboutToShow(IMenu Manager)
> */
> public void menuAboutToShow(IMenuManager manager) {
> manager.add()
> }
> });
>
> menu.addMenuListener(new MenuListener() {
> public void menuHidden(MenuEvent e) {
> System.out.println("menuHidden");
> }
> public void menuShown(MenuEvent e) {
> System.out.println("menuShown");
> }
> });
> MenuItem menuItem = new MenuItem(menu, SWT.CASCADE);
> menuItem.setText("Delete");
> menuItem.addSelectionListener(new SelectionListener() {
> /**
> * @see
> org.eclipse.swt.events.SelectionListener#widgetSelected(Sele ctionEvent)
> */
> public void widgetSelected(SelectionEvent e) {
> System.out.println("widgetSelected");
> }
> /**
> * @see
>
org.eclipse.swt.events.SelectionListener#widgetDefaultSelect ed(SelectionEven
> t)
> */
> public void widgetDefaultSelected(SelectionEvent e) {
> System.out.println("widgetDefaultSelected");
> }
> });
> menu.setVisible(true);
>
>
> When the IEditorPart is started I can see on the console
>
> menuAboutToShow
> menuShown
> menuHidden
>
> but nothing else is displayed and I see no popup menu...
>
> Thanks in advance
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03774 seconds