java.lang.Objectorg.eclipse.ui.application.WorkbenchAdvisor
com.ibm.jdg2e.miniwp.MiniWPWorkbenchAdvisor
The heart of the Mini-Workplace, MiniWPWorkbenchAdvisor,
decides what elements make up the main window and the set of
base actions.
| Field Summary |
| Fields inherited from class org.eclipse.ui.application.WorkbenchAdvisor |
FILL_COOL_BAR, FILL_MENU_BAR, FILL_PROXY, FILL_STATUS_LINE |
| Constructor Summary | |
MiniWPWorkbenchAdvisor()
|
|
| 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. |
void |
fillActionBars(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer,
int flags)
Fill the toolbar and menu bar with the base actions. |
protected void |
fillCoolBar(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
Fill the base coolbar items that are always accessible, like in our case, the Save toolbar button. |
protected void |
fillMenuBar(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
Fill the menu bar with the standard based choices for the Mini-Workplace. |
java.lang.String |
getInitialWindowPerspectiveId()
Return the "main" perspective as defined in the org.eclipse.ui.perspectives
extension. |
void |
postWindowOpen(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)
Handle window initialization now that the main window's shell is available. |
void |
preWindowOpen(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)
Decide what window elements the Mini-Workplace needs. |
| Methods inherited from class org.eclipse.ui.application.WorkbenchAdvisor |
createWindowContents, eventLoopException, eventLoopIdle, getDefaultPageInput, getMainPreferencePageId, getWorkbenchConfigurer, initialize, internalBasicInitialize, isApplicationMenu, openIntro, openWindows, postShutdown, postStartup, postWindowClose, postWindowCreate, postWindowRestore, preShutdown, preStartup, preWindowShellClose |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MiniWPWorkbenchAdvisor()
| Method Detail |
protected org.eclipse.jface.action.MenuManager createEditMenu(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
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).
protected org.eclipse.jface.action.MenuManager createFileMenu(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
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).
protected org.eclipse.jface.action.MenuManager createHelpMenu(org.eclipse.ui.IWorkbenchWindow window)
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.
protected org.eclipse.jface.action.MenuManager createWindowMenu(org.eclipse.ui.IWorkbenchWindow window)
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).
public void fillActionBars(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer,
int flags)
protected void fillCoolBar(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
protected void fillMenuBar(org.eclipse.ui.IWorkbenchWindow window,
org.eclipse.ui.application.IActionBarConfigurer configurer)
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).
public java.lang.String getInitialWindowPerspectiveId()
org.eclipse.ui.perspectives
extension.
MiniWPPerspectiveFactorypublic void postWindowOpen(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)
public void preWindowOpen(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer)