KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > action > SubToolBarManager


1 /*******************************************************************************
2  * Copyright (c) 2000, 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 package org.eclipse.jface.action;
12
13 /**
14  * A <code>SubToolBarManager</code> monitors the additional and removal of
15  * items from a parent manager so that visibility of the entire set can be changed as a
16  * unit.
17  */

18 public class SubToolBarManager extends SubContributionManager implements
19         IToolBarManager {
20
21     /**
22      * Constructs a new manager.
23      *
24      * @param mgr the parent manager. All contributions made to the
25      * <code>SubToolBarManager</code> are forwarded and appear in the
26      * parent manager.
27      */

28     public SubToolBarManager(IToolBarManager mgr) {
29         super(mgr);
30     }
31
32     /**
33      * @return the parent toolbar manager that this sub-manager contributes to
34      */

35     protected final IToolBarManager getParentToolBarManager() {
36         // Cast is ok because that's the only
37
// thing we accept in the construtor.
38
return (IToolBarManager) getParent();
39     }
40
41     /* (non-Javadoc)
42      * Method declared on IToolBarManager.
43      */

44     public void update(boolean force) {
45         // This method is not governed by visibility. The client may
46
// call <code>setVisible</code> and then force an update. At that
47
// point we need to update the parent.
48
getParentToolBarManager().update(force);
49     }
50 }
51
Popular Tags