How to add menus with SWT Designer?

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

How to add menus with SWT Designer?

Postby P38 » Thu Mar 10, 2011 11:31 am

We have a JFace ApplicationWindow in a standalone SWT/JFace app designed with SWT Designer.

We have a top level menu that appears OK. It is generated by this code:

Code: Select all
@Override
   protected MenuManager createMenuManager() {
      MenuManager topLevelMenuManager = new MenuManager();

      MenuManager fileMenu = new MenuManager("&File");
      topLevelMenuManager.add(fileMenu);

      MenuManager editMenu = new MenuManager("&Edit");
      topLevelMenuManager.add(editMenu);

      MenuManager helpMenu = new MenuManager("&Help");
      topLevelMenuManager.add(helpMenu);

      return topLevelMenuManager;
   }

How do we add menu items to this?
P38
 
Posts: 8
Joined: Wed Feb 09, 2011 11:35 am

Re: How to add menus with SWT Designer?

Postby Eric Clayberg » Thu Mar 10, 2011 12:14 pm

All menus in a JFace App Windows are Actions, so use the JFace Actions palette. This is described in the docs...

Image
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

cron