01: package net.refractions.udig.internal.ui;
02:
03: import org.eclipse.jface.action.ICoolBarManager;
04: import org.eclipse.jface.action.IMenuManager;
05: import org.eclipse.ui.IWorkbenchWindow;
06: import org.eclipse.ui.PlatformUI;
07: import org.eclipse.ui.application.ActionBarAdvisor;
08: import org.eclipse.ui.application.IActionBarConfigurer;
09: import org.eclipse.ui.application.WorkbenchWindowAdvisor;
10:
11: /**
12: * Public base class for configuring the action bars of a workbench window.
13: * <p>
14: * An application should declare a subclass of <code>ActionBarAdvisor</code>
15: * and override methods to configure a window's action bars to suit the needs of the
16: * particular application.
17: * </p>
18: * <p>
19: * The following advisor methods are called at strategic points in the
20: * workbench's lifecycle (all occur within the dynamic scope of the call
21: * to {@link PlatformUI#createAndRunWorkbench PlatformUI.createAndRunWorkbench}):
22: * <ul>
23: * <li><code>fillActionBars</code> - called after <code>WorkbenchWindowAdvisor.preWindowOpen</code>
24: * to configure a window's action bars</li>
25: * </ul>
26: * </p>
27: *
28: * @see WorkbenchWindowAdvisor#createActionBarAdvisor(IActionBarConfigurer)
29: *
30: * @author cole.markham
31: * @since 1.0.0
32: */
33: public class UDIGActionBarAdvisor extends ActionBarAdvisor {
34:
35: /**
36: * Default constructor
37: * @param configurer
38: */
39: public UDIGActionBarAdvisor(IActionBarConfigurer configurer) {
40: super (configurer);
41: }
42:
43: @Override
44: protected void fillCoolBar(ICoolBarManager coolBar) {
45: IWorkbenchWindow window = getActionBarConfigurer()
46: .getWindowConfigurer().getWindow();
47: UiPlugin.getDefault().getMenuFactory().fillCoolBar(coolBar,
48: window);
49: }
50:
51: @Override
52: protected void fillMenuBar(IMenuManager menuBar) {
53: IWorkbenchWindow window = getActionBarConfigurer()
54: .getWindowConfigurer().getWindow();
55: UiPlugin.getDefault().getMenuFactory().fillMenuBar(menuBar,
56: window);
57:
58: }
59:
60: }
|