Elexis API documentation
Version 2.1.6 as of December 11 2011

ch.elexis.util
Class ViewMenus

java.lang.Object
  extended by ch.elexis.util.ViewMenus

public class ViewMenus
extends java.lang.Object

This class simplifies the handling of menus and toolbars.

Author:
gerry

Nested Class Summary
static interface ViewMenus.IMenuPopulator
           
 
Constructor Summary
ViewMenus(IViewSite s)
           
 
Method Summary
 void createControlContextMenu(Control control, IAction... actions)
          Creates a menu for the given control containing the given actions
 void createControlContextMenu(Control control, ViewMenus.IMenuPopulator populator)
          Creates a menu for the given Control that will be populated by the provided populator This can be used to construct dynamic menus that change contents depending of state.
 void createMenu(IAction... actions)
          Create a menu containing the specified actions.
 void createToolbar(IAction... actions)
          Create a toolbar containing the specified actions
 void createViewerContextMenu(StructuredViewer viewer, IAction... actions)
          Attach a context menu to a org.eclipse.jface.StructuredViewer
 MenuManager getContextMenu()
          Return the context menu for registration with the selectionProvider
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewMenus

public ViewMenus(IViewSite s)
Method Detail

createMenu

public void createMenu(IAction... actions)
Create a menu containing the specified actions.

Parameters:
actions - a collection of actions and null-values (that represent separators)

createToolbar

public void createToolbar(IAction... actions)
Create a toolbar containing the specified actions

Parameters:
actions - a collection of actions and null-values (that represent separators)

createViewerContextMenu

public void createViewerContextMenu(StructuredViewer viewer,
                                    IAction... actions)
Attach a context menu to a org.eclipse.jface.StructuredViewer

Parameters:
viewer - the viewer
actions - the actions to use

createControlContextMenu

public void createControlContextMenu(Control control,
                                     IAction... actions)
Creates a menu for the given control containing the given actions

Parameters:
control - the Control to add the menu to
actions - the actions to be shown in the menu

getContextMenu

public MenuManager getContextMenu()
Return the context menu for registration with the selectionProvider

Returns:
MenuManager for the contextMenu

createControlContextMenu

public void createControlContextMenu(Control control,
                                     ViewMenus.IMenuPopulator populator)
Creates a menu for the given Control that will be populated by the provided populator This can be used to construct dynamic menus that change contents depending of state.


Elexis API documentation
Version 2.1.6 as of December 11 2011

Copyright 2005-2011 by Gerry Weirich, Elexis