Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Popup Menu
Popup Menu [message #71263] Tue, 18 March 2003 10:08 Go to next message
Eclipse UserFriend
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 #71362 is a reply to message #71263] Tue, 18 March 2003 17:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Could you paste in HTML so the code doesn't get mangled?
Re: Popup Menu [message #71379 is a reply to message #71263] Tue, 18 March 2003 19:50 Go to previous message
Eclipse UserFriend
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
>
>
Previous Topic:NODE_ROLE & NodeEditPolicy
Next Topic:Create GEF Editor like the Compare Editor
Goto Forum:
  


Current Time: Sat Oct 19 19:30:16 GMT 2024

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

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

Back to the top