com.ibm.jdg2e.miniwp
Class MiniWPActionBarAdvisor

java.lang.Object
  extended byorg.eclipse.ui.application.ActionBarAdvisor
      extended bycom.ibm.jdg2e.miniwp.MiniWPActionBarAdvisor

public class MiniWPActionBarAdvisor
extends org.eclipse.ui.application.ActionBarAdvisor


Field Summary
 
Fields inherited from class org.eclipse.ui.application.ActionBarAdvisor
FILL_COOL_BAR, FILL_MENU_BAR, FILL_PROXY, FILL_STATUS_LINE
 
Constructor Summary
MiniWPActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer configurer)
          Creates a new action bar advisor to configure a workbench window's action bars via the given action bar configurer.
 
Method Summary
protected  org.eclipse.jface.action.MenuManager createEditMenu(org.eclipse.ui.IWorkbenchWindow window, org.eclipse.ui.application.IActionBarConfigurer configurer)
          Fill the Edit pulldown menu with the standard separators, ready to accept contributions.
protected  org.eclipse.jface.action.MenuManager createFileMenu(org.eclipse.ui.IWorkbenchWindow window, org.eclipse.ui.application.IActionBarConfigurer configurer)
          Fill the File pulldown menu with the standard separators, ready to accept contributions.
protected  org.eclipse.jface.action.MenuManager createHelpMenu(org.eclipse.ui.IWorkbenchWindow window)
          Add the standard Help pulldown menu insertion points so the Mini-Workbench is help-enabled (Exercise 7, Developing Your First Rich Client Application covers these steps).
protected  org.eclipse.jface.action.MenuManager createWindowMenu(org.eclipse.ui.IWorkbenchWindow window)
          Fill the Window pulldown menu with the standard separators, ready to accept contributions.
protected  void fillCoolBar(org.eclipse.jface.action.ICoolBarManager cbManager)
          Fill the base coolbar items that are always accessible, like in our case, the Save toolbar button.
protected  void fillMenuBar(org.eclipse.jface.action.IMenuManager menuBar)
          Fill the menu bar with the standard based choices for the Mini-Workplace.
protected  void makeActions(org.eclipse.ui.IWorkbenchWindow window)
          Instantiates the actions used in the fill methods.
 
Methods inherited from class org.eclipse.ui.application.ActionBarAdvisor
dispose, disposeAction, disposeActions, fillActionBars, fillStatusLine, getAction, getActionBarConfigurer, isApplicationMenu, register, restoreState, saveState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiniWPActionBarAdvisor

public MiniWPActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer configurer)
Creates a new action bar advisor to configure a workbench window's action bars via the given action bar configurer.

Parameters:
configurer - the action bar configurer
Method Detail

createEditMenu

protected org.eclipse.jface.action.MenuManager createEditMenu(org.eclipse.ui.IWorkbenchWindow window,
                                                              org.eclipse.ui.application.IActionBarConfigurer configurer)
Fill the Edit pulldown menu with the standard separators, ready to accept contributions. See org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor for more example code.

Note: This method registers global actions. Its tests for previously created menus is necessary because this method may be called multiple times (e.g., by the Window > Customize Perspective... dialog to create its menu proxies that show the structure of the menu).


createFileMenu

protected org.eclipse.jface.action.MenuManager createFileMenu(org.eclipse.ui.IWorkbenchWindow window,
                                                              org.eclipse.ui.application.IActionBarConfigurer configurer)
Fill the File pulldown menu with the standard separators, ready to accept contributions. See org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor for more example code.

Note: This method registers global actions. Its tests for previously created menus is necessary because this method may be called multiple times (e.g., by the Window > Customize Perspective... dialog to create its menu proxies that show the structure of the menu).


createHelpMenu

protected org.eclipse.jface.action.MenuManager createHelpMenu(org.eclipse.ui.IWorkbenchWindow window)
Add the standard Help pulldown menu insertion points so the Mini-Workbench is help-enabled (Exercise 7, Developing Your First Rich Client Application covers these steps).

Note: The standard About dialog relies on the application being "productized" to retrieve its content. Otherwise it will be empty, as you'll see if you run the Mini-Workplace as an application (not product). Chapter 13, Defining Features and Products, explains the process. See the rcp_miniwp_product directory on the CD-ROM for a production version of this example.


createWindowMenu

protected org.eclipse.jface.action.MenuManager createWindowMenu(org.eclipse.ui.IWorkbenchWindow window)
Fill the Window pulldown menu with the standard separators, ready to accept contributions. See org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor for more example code.

Notice that not all menu choices that you might expect in the Eclipse IDE are included here. The Mini-Workplace could choose to use a completely different scheme for transitioning between perspectives (or even use multiple main windows instead and hide the fact that perspectives from the user).

To keep this implementation somewhat familiar, it includes some recognizable standard choices from the Generic Workbench. This example also shows how the advisor can "help" the standard actions by handling their enablement, as is the case for the Customize Perspective... choice (internally known as EDIT_ACTION_SETS). Finally, createWindowMenu leaves a place for extensions to the Preferences dialog, although the Mini-Workplace itself doesn't define any. This allows for the other chapter examples that do contribute preferences to optionally be included in this example (see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor for more example code).


fillCoolBar

protected void fillCoolBar(org.eclipse.jface.action.ICoolBarManager cbManager)
Fill the base coolbar items that are always accessible, like in our case, the Save toolbar button. In the current implementation, the Workbench expects there will be at least one item in the coolbar. Otherwise the sizing of the toolbar is incorrect (see bug 70049 for details).


fillMenuBar

protected void fillMenuBar(org.eclipse.jface.action.IMenuManager menuBar)
Fill the menu bar with the standard based choices for the Mini-Workplace. Many of these are actions from the Generic Workbench that we're reusing. This saves us time and also enables other plug-ins that "expect" certain menus choices to function (e.g., Edit > Cut / Copy / Paste).

The actions below are created directly to make this code a bit more readable. In many case, however, other advisor methods will need a reference to these actions, so they would be stored in fields of this class. (see org.eclipse.ui.internal.ide.IDEWorkbenchAdvisor for more example code).


makeActions

protected void makeActions(org.eclipse.ui.IWorkbenchWindow window)
Instantiates the actions used in the fill methods.