public class SubMenuManager extends SubContributionManager implements IMenuManager
SubMenuManager is used to define a set of contribution
items within a parent manager. Once defined, the visibility of the entire set can
be changed as a unit.
A client may ask for and make additions to a submenu. The visibility of these items
is also controlled by the visibility of the SubMenuManager.
| Constructor and Description |
|---|
SubMenuManager(IMenuManager mgr)
Constructs a new manager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMenuListener(IMenuListener listener)
Adds a menu listener to this menu.
|
void |
dispose()
The default implementation of this
IContributionItem
method does nothing. |
void |
disposeManager()
Disposes this sub contribution manager, removing all its items
and cleaning up any other resources allocated by it.
|
void |
fill(Composite parent)
Fills the given composite control with controls representing this
contribution item.
|
void |
fill(CoolBar parent,
int index)
Fills the given cool bar with controls representing this contribution item.
|
void |
fill(Menu parent,
int index)
Fills the given menu with controls representing this contribution item.
|
void |
fill(ToolBar parent,
int index)
Fills the given tool bar with controls representing this contribution item.
|
IContributionItem |
find(String id)
Finds the contribution item with the given id.
|
IMenuManager |
findMenuUsingPath(String path)
The menu returned is wrapped within a
SubMenuManager to
monitor additions and removals. |
IContributionItem |
findUsingPath(String path)
Finds the contribution item at the given path.
|
String |
getId()
Returns the identifier of this contribution item.
|
protected IMenuManager |
getParentMenuManager()
Returns the parent menu manager that this sub-manager contributes to.
|
boolean |
getRemoveAllWhenShown()
Returns whether all items should be removed when the menu is about to
show, but before notifying menu listeners.
|
protected IMenuManager |
getWrapper(IMenuManager mgr)
Returns the menu wrapper for a menu manager.
|
boolean |
isDynamic()
Returns whether this contribution item is dynamic.
|
boolean |
isEnabled()
Returns whether this menu should be enabled or not.
|
boolean |
isGroupMarker()
Returns whether this contribution item is a group marker.
|
boolean |
isSeparator()
Returns whether this contribution item is a separator.
|
void |
removeAll()
Remove all contribution items.
|
void |
removeMenuListener(IMenuListener listener)
Removes the given menu listener from this menu.
|
void |
saveWidgetState()
Saves any state information of the control(s) owned by this contribution item.
|
void |
setParent(IContributionManager parent)
Sets the parent manager of this item
|
void |
setRemoveAllWhenShown(boolean removeAll)
Sets whether all items should be removed when the menu is about to show,
but before notifying menu listeners.
|
void |
setVisible(boolean visible)
Sets the visibility of the manager.
|
void |
update()
Updates any SWT controls cached by this contribution item with any
changes which have been made to this contribution item since the last update.
|
void |
update(boolean force)
Updates this manager's underlying widget(s) with any changes which
have been made to it or its items.
|
void |
update(String id)
Updates any SWT controls cached by this contribution item with changes
for the the given property.
|
void |
updateAll(boolean force)
Incrementally builds the menu from the contribution items, and
does so recursively for all submenus.
|
protected SubMenuManager |
wrapMenu(IMenuManager menu)
Wraps a menu manager in a sub menu manager, and returns the new wrapper.
|
add, add, appendToGroup, appendToGroup, getItems, getOverrides, getParent, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, isVisible, itemAdded, itemRemoved, items, markDirty, prependToGroup, prependToGroup, remove, remove, unwrap, wrapclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, add, appendToGroup, appendToGroup, getItems, getOverrides, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, removeisDirty, isVisiblepublic SubMenuManager(IMenuManager mgr)
mgr - the parent manager. All contributions made to the
SubMenuManager are forwarded and appear in the
parent manager.public void addMenuListener(IMenuListener listener)
IMenuManageraddMenuListener in interface IMenuManagerlistener - a menu listenerpublic void dispose()
IContributionItem
method does nothing. Subclasses may override.dispose in interface IContributionItempublic void disposeManager()
SubContributionManagerdisposeManager in class SubContributionManagerpublic void fill(Composite parent)
IContributionItemStatusLineManager.fill in interface IContributionItemparent - the parent controlpublic void fill(CoolBar parent, int index)
IContributionItemCoolBarManager.fill in interface IContributionItemparent - the parent cool barindex - the index where the controls are inserted,
or -1 to insert at the endpublic void fill(Menu parent, int index)
IContributionItemMenuManager.fill in interface IContributionItemparent - the parent menuindex - the index where the controls are inserted,
or -1 to insert at the endpublic void fill(ToolBar parent, int index)
IContributionItemToolBarManager.fill in interface IContributionItemparent - the parent tool barindex - the index where the controls are inserted,
or -1 to insert at the endpublic IContributionItem find(String id)
IContributionManagerfind in interface IContributionManagerfind in class SubContributionManagerid - the contribution item idnull if
no item with the given id can be foundpublic IMenuManager findMenuUsingPath(String path)
The menu returned is wrapped within a SubMenuManager to
monitor additions and removals. If the visibility of this menu is modified
the visibility of the submenus is also modified.
findMenuUsingPath in interface IMenuManagerpath - the path stringnull
if there is no such contribution item or if the item does
not have an associated menu managerpublic IContributionItem findUsingPath(String path)
IMenuManager'/'.findUsingPath in interface IMenuManagerpath - the path stringnull if there is no
such contribution itempublic String getId()
IContributionItemgetId in interface IContributionItemnull
if noneprotected final IMenuManager getParentMenuManager()
public boolean getRemoveAllWhenShown()
IMenuManagerfalse.getRemoveAllWhenShown in interface IMenuManagertrue if all items should be removed when shown,
false if notprotected IMenuManager getWrapper(IMenuManager mgr)
The sub menus within this menu are wrapped within a SubMenuManager to
monitor additions and removals. If the visibility of this menu is modified
the visibility of the sub menus is also modified.
public boolean isDynamic()
IContributionItemisDynamic in interface IContributionItemtrue if this item is dynamic, and
false for normal itemspublic boolean isEnabled()
IMenuManagerisEnabled in interface IContributionItemisEnabled in interface IMenuManagertrue if enabled, and
false if disabledpublic boolean isGroupMarker()
IContributionItemisGroupMarker in interface IContributionItemtrue if this item is a group marker, and
false for normal itemsGroupMarker,
IContributionManager.appendToGroup(String, IContributionItem),
IContributionManager.prependToGroup(String, IContributionItem)public boolean isSeparator()
IContributionItemisSeparator in interface IContributionItemtrue if this item is a separator, and
false for normal itemsSeparatorpublic void removeAll()
removeAll in interface IContributionManagerremoveAll in class SubContributionManagerpublic void removeMenuListener(IMenuListener listener)
IMenuManagerremoveMenuListener in interface IMenuManagerlistener - the menu listenerpublic void saveWidgetState()
IContributionItemsaveWidgetState in interface IContributionItempublic void setParent(IContributionManager parent)
IContributionItemsetParent in interface IContributionItemparent - the parent contribution managerpublic void setRemoveAllWhenShown(boolean removeAll)
IMenuManagersetRemoveAllWhenShown in interface IMenuManagerremoveAll - true if all items should be removed when shown,
false if notpublic void setVisible(boolean visible)
SubContributionManagertrue
then each item within the manager appears within the parent manager.
Otherwise, the items are not visible.setVisible in interface IContributionItemsetVisible in class SubContributionManagervisible - the new visibilitypublic void update()
IContributionItemupdate in interface IContributionItempublic void update(boolean force)
IContributionManagerupdate in interface IContributionManagerforce - true means update even if not dirty,
and false for normal incremental updatingpublic void update(String id)
IContributionItemupdate in interface IContributionItemid - the id of the changed propertypublic void updateAll(boolean force)
IMenuManagerupdateAll in interface IMenuManagerforce - true means update even if not dirty,
and false for normal incremental updatingprotected SubMenuManager wrapMenu(IMenuManager menu)
Guidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.