Dashboard > UDIG Developer Guide > Home > 4 Working with Eclipse RCP > 06 Traditional Menus using Actions and ActionSets
06 Traditional Menus using Actions and ActionSets Log In | Sign Up   View a printable version of the current page.

Added by Administrator , last edited by Administrator on Nov 23, 2007  (view change)
Labels: 
(None)

Contribution additional functionality into Eclipse RCP applications is traditionally done with Actions. This functionality is now deprecated; new code should look into use commands and handlers.

Related Information

Menu Path Constants

The class UDIGActionBarAdvisor is used to define the menu paths on this page in the usual manner; submitting a series of contributions to a "MenuManager" relative to series of known constant locations.

These locations are defined as Constants in the following files:

  • IWorkbenchActionConstants: well known locations for RCP applications
  • Constants: well known locations for uDig applications

Use of IAction

There are many examples of the use IAction, the related extention points are deprecated:

  • org.eclipse.ui.ActionsSets
  • org.eclipse.ui.EditorActions
  • org.eclipse.ui.popupMenus
  • org.eclipse.ui.viewActions

When possible please make use of org.eclipse.ui.menu.

Default RCP Menus Paths

For the uDig application (net.refractions.udig.ui) these reference points are contributed directly by the UDIGActionBarAdvisor. Most of these are from IWorkbenchActionConstants and can be expected in any RCP application.

Standard menus expected for any RCP application:

  • file
  • edit
  • additions (group)- ie. IWorkbenchActionConstants.MB_ADDITIONS
  • window
  • help

File menu:

  • file/fileStart
  • file/new.ext
  • file/new
  • file/close.ext
  • file/close
  • file/save.ext
  • file/save
  • file/additions
  • file/print.ext
  • file/import.ext
  • file/import
  • file/export
  • file/mru
  • file/fileEnd
  • file/quit

Edit menu:

  • edit/editStart
  • edit/undo
  • edit/redo
  • edit/undo.ext
  • edit/cut
  • edit/copy
  • edit/paste
  • edit/cut.ext
  • edit/delete
  • edit/selectAll
  • edit/bookmark
  • edit/editEnd

When creating your own RCP application please ensure the above menu paths are available (other uDig modules expect to be able to use them). This should be pretty easy as they are all based on the usual IWorkbenchActionConstants.

Examples menu paths:

  • menu:org.eclipse.ui.main.menu?after=additions
  • menu:org.eclipse.ui.main.menu?after=file/new
  • toolbar:org.eclipse.ui.main.toolbar?after=additions

Example for any popup (must use visibleWhen):

  • popup:org.eclipse.ui.popup.any?after=additions

Adding an IAction using an ActionBarAdvisor

IMenuManager fileMenu = menuBar.findMenuUsingPath(IWorkbenchActionConstants.M_FILE);

IAction exit = ActionFactory.QUIT.create(window);
fileMenu.insertAfter(Constants.FILE_END, exit);

You would be doing this sort of thing if you are rolling your own ActionBarAdvisor as part of a new RCP Application. As of Eclipse 3.3 you should be able to use the org.eclipse.ui.menu extension point and avoid this step.

Adding an IAction using an ActionSet

You can also define ActionSets that map from an IAction to a menu path.

<!-- pending -->

This is the preferred way since the resulting ActionSet can be toggle on and off when switching perspectives.

Geospatial Platform Menu Paths

These paths are contributed by the org.eclipse.ui.menu extension point as part of net.refractions.udig.catalog.ui.

Data menu:

  • data/dataStart
  • ..
  • data/additions
  • data/dataEnd

Available Views

Catalog view:

  • menu:net.refractions.udig.catalog.ui.CatalogView?after=additions
  • popup:net.refractions.udig.catalog.ui.CatalogView?after=additions

Search view:

  • menu:net.refractions.udig.catalog.ui.Search?after=additions
  • popup:net.refractions.udig.catalog.ui.Search?after=additions

Available Nouns

When using a contribution to any context menu:

  • popup:org.eclipse.ui.popup.any?after=additions

Geospatial Application Menu Paths

Navigation menu:

  • navigate/navStart
  • ...
  • navigation/additions
  • navigation/navEnd

Layer menu:

  • layer/layerStart
  • ...
  • layer/additions
  • layer/LayerEnd

Map menu:

  • map/mapStart
  • ...
  • map/additions
  • map/mapEnd
Powered by a free Atlassian Confluence Open Source Project License granted to uDig. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators
User-friendly Desktop Internet GIS