KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > menus > AbstractWorkbenchTrimWidget


1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  ******************************************************************************/

11
12 package org.eclipse.ui.menus;
13
14 import org.eclipse.jface.menus.AbstractTrimWidget;
15 import org.eclipse.swt.graphics.Point;
16 import org.eclipse.ui.IWorkbenchWindow;
17
18 /**
19  * Extension for trim widgets contributed to the workbench.
20  * The extension point handler will call the <code>init</code>
21  * method to inform the contributed widgets as to which
22  * workbench window they're currently being hosted in.
23  *
24  * @since 3.2
25  *
26  */

27 public abstract class AbstractWorkbenchTrimWidget extends AbstractTrimWidget implements IWorkbenchWidget {
28     
29     private IWorkbenchWindow wbWindow;
30
31     /**
32      *
33      */

34     public AbstractWorkbenchTrimWidget() {
35         super();
36     }
37     
38
39     /**
40      * Define the IWorkbenchWindow that this trim is being hosted in.
41      * Note that subclasses may extend but should not override. The
42      * base implementation caches the value for access through the
43      * <code>getWorkbenchWindow</code> method.
44      *
45      * @see org.eclipse.ui.menus.IWorkbenchWidget#init(org.eclipse.ui.IWorkbenchWindow)
46      */

47     public void init(IWorkbenchWindow workbenchWindow) {
48         wbWindow = workbenchWindow;
49     }
50     
51     /**
52      * Convenience method to get the IWorkbenchWindow that is
53      * hosting this widget.
54      *
55      * @return The IWorkbenchWindow hosting this widget.
56      */

57     public IWorkbenchWindow getWorkbenchWindow() {
58         return wbWindow;
59     }
60     
61     /**
62      * @return The preferred size of this item
63      * @since 3.3
64      */

65     public Point getPreferredSize() {
66         return null;
67     }
68 }
69
Popular Tags