KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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  * The <code>IMenuManager</code> interface provides protocol for managing
15  * contributions to a menu bar and its sub menus.
16  * An <code>IMenuManager</code> is also an <code>IContributionItem</code>,
17  * allowing sub-menus to be nested in parent menus.
18  * <p>
19  * This interface is internal to the framework; it should not be implemented outside
20  * the framework.
21  * </p>
22  * <p>
23  * This package provides a concrete menu manager implementation,
24  * {@link MenuManager <code>MenuManager</code>}.
25  * </p>
26  */

27 public interface IMenuManager extends IContributionManager, IContributionItem {
28     /**
29      * Adds a menu listener to this menu.
30      * Has no effect if an identical listener is already registered.
31      *
32      * @param listener a menu listener
33      */

34     public void addMenuListener(IMenuListener listener);
35
36     /**
37      * Finds the manager for the menu at the given path. A path
38      * consists of contribution item ids separated by the separator
39      * character. The path separator character is <code>'/'</code>.
40      * <p>
41      * Convenience for <code>findUsingPath(path)</code> which
42      * extracts an <code>IMenuManager</code> if possible.
43      * </p>
44      *
45      * @param path the path string
46      * @return the menu contribution item, or <code>null</code>
47      * if there is no such contribution item or if the item does
48      * not have an associated menu manager
49      */

50     public IMenuManager findMenuUsingPath(String JavaDoc path);
51
52     /**
53      * Finds the contribution item at the given path. A path
54      * consists of contribution item ids separated by the separator
55      * character. The path separator character is <code>'/'</code>.
56      *
57      * @param path the path string
58      * @return the contribution item, or <code>null</code> if there is no
59      * such contribution item
60      */

61     public IContributionItem findUsingPath(String JavaDoc path);
62
63     /**
64      * Returns whether all items should be removed when the menu is about to
65      * show, but before notifying menu listeners. The default is
66      * <code>false</code>.
67      *
68      * @return <code>true</code> if all items should be removed when shown,
69      * <code>false</code> if not
70      */

71     public boolean getRemoveAllWhenShown();
72
73     /**
74      * Returns whether this menu should be enabled or not.
75      *
76      * @return <code>true</code> if enabled, and
77      * <code>false</code> if disabled
78      */

79     public boolean isEnabled();
80
81     /**
82      * Removes the given menu listener from this menu.
83      * Has no effect if an identical listener is not registered.
84      *
85      * @param listener the menu listener
86      */

87     public void removeMenuListener(IMenuListener listener);
88
89     /**
90      * Sets whether all items should be removed when the menu is about to show,
91      * but before notifying menu listeners.
92      *
93      * @param removeAll
94      * <code>true</code> if all items should be removed when shown,
95      * <code>false</code> if not
96      */

97     public void setRemoveAllWhenShown(boolean removeAll);
98
99     /**
100      * Incrementally builds the menu from the contribution items, and
101      * does so recursively for all submenus.
102      *
103      * @param force <code>true</code> means update even if not dirty,
104      * and <code>false</code> for normal incremental updating
105      */

106     public void updateAll(boolean force);
107 }
108
Popular Tags