01: /*******************************************************************************
02: * Copyright (c) 2004, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.rcp.browser;
11:
12: import org.eclipse.swt.graphics.Point;
13: import org.eclipse.ui.application.ActionBarAdvisor;
14: import org.eclipse.ui.application.IActionBarConfigurer;
15: import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
16: import org.eclipse.ui.application.WorkbenchWindowAdvisor;
17:
18: /**
19: * Configures the browser window using the given window configurer.
20: *
21: * @since 3.1
22: */
23: public class BrowserWindowAdvisor extends WorkbenchWindowAdvisor {
24:
25: /**
26: * Creates a new browser window advisor.
27: *
28: * @param configurer the window configurer
29: */
30: public BrowserWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
31: super (configurer);
32: }
33:
34: /* (non-Javadoc)
35: * @see org.eclipse.ui.application.WorkbenchAdvisor
36: */
37: public void preWindowOpen() {
38: IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
39: configurer.setInitialSize(new Point(800, 600));
40:
41: // Default window title is the product name, so don't need to set it
42: // explicitly anymore.
43: // configurer.setTitle("Browser Example");
44:
45: // configurer.setShowFastViewBars(true);
46: }
47:
48: /* (non-Javadoc)
49: * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer)
50: */
51: public ActionBarAdvisor createActionBarAdvisor(
52: IActionBarConfigurer actionBarConfigurer) {
53: return new BrowserActionBarAdvisor(actionBarConfigurer);
54: }
55:
56: // Uncomment the code below for a custom window layout (add back the missing imports using Ctrl+Shift+O)
57: /*
58: public void createWindowContents(Shell shell) {
59: IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
60: Menu menuBar = configurer.createMenuBar();
61: shell.setMenuBar(menuBar);
62:
63: GridLayout shellLayout = new GridLayout();
64: shellLayout.marginWidth = 0;
65: shellLayout.marginHeight = 0;
66: shellLayout.verticalSpacing = 0;
67: shell.setLayout(shellLayout);
68:
69: if (!"carbon".equals(SWT.getPlatform())) { //$NON-NLS-1$
70: Label sep1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
71: sep1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
72: }
73: Control coolBar = configurer.createCoolBarControl(shell);
74: coolBar.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
75:
76: Label sep2 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
77: sep2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
78:
79: Control pageComposite = configurer.createPageComposite(shell);
80: pageComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
81:
82: Label sep3 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
83: sep3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
84: Control statusLine = configurer.createStatusLineControl(shell);
85: statusLine.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
86: shell.layout(true);
87: }
88: */
89: }
|