01: /*******************************************************************************
02: * Copyright (c) 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.menus;
11:
12: import org.eclipse.jface.menus.AbstractTrimWidget;
13: import org.eclipse.swt.graphics.Point;
14: import org.eclipse.ui.IWorkbenchWindow;
15:
16: /**
17: * Extension for trim widgets contributed to the workbench.
18: * The extension point handler will call the <code>init</code>
19: * method to inform the contributed widgets as to which
20: * workbench window they're currently being hosted in.
21: *
22: * @since 3.2
23: *
24: */
25: public abstract class AbstractWorkbenchTrimWidget extends
26: AbstractTrimWidget implements IWorkbenchWidget {
27:
28: private IWorkbenchWindow wbWindow;
29:
30: /**
31: *
32: */
33: public AbstractWorkbenchTrimWidget() {
34: super ();
35: }
36:
37: /**
38: * Define the IWorkbenchWindow that this trim is being hosted in.
39: * Note that subclasses may extend but should not override. The
40: * base implementation caches the value for access through the
41: * <code>getWorkbenchWindow</code> method.
42: *
43: * @see org.eclipse.ui.menus.IWorkbenchWidget#init(org.eclipse.ui.IWorkbenchWindow)
44: */
45: public void init(IWorkbenchWindow workbenchWindow) {
46: wbWindow = workbenchWindow;
47: }
48:
49: /**
50: * Convenience method to get the IWorkbenchWindow that is
51: * hosting this widget.
52: *
53: * @return The IWorkbenchWindow hosting this widget.
54: */
55: public IWorkbenchWindow getWorkbenchWindow() {
56: return wbWindow;
57: }
58:
59: /**
60: * @return The preferred size of this item
61: * @since 3.3
62: */
63: public Point getPreferredSize() {
64: return null;
65: }
66: }
|