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)
Method declared on IContributionManager.
|
IMenuManager |
findMenuUsingPath(String path)
The menu returned is wrapped within a
SubMenuManager to
monitor additions and removals. |
IContributionItem |
findUsingPath(String path)
Method declared on IMenuManager.
|
String |
getId()
Returns the identifier of this contribution item.
|
protected IMenuManager |
getParentMenuManager() |
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, wrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
add, add, appendToGroup, appendToGroup, getItems, getOverrides, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove
isDirty, isVisible
public 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)
IMenuManager
addMenuListener
in interface IMenuManager
listener
- a menu listenerpublic void dispose()
IContributionItem
method does nothing. Subclasses may override.dispose
in interface IContributionItem
public void disposeManager()
SubContributionManager
disposeManager
in class SubContributionManager
public void fill(Composite parent)
IContributionItem
StatusLineManager
.fill
in interface IContributionItem
parent
- the parent controlpublic void fill(CoolBar parent, int index)
IContributionItem
CoolBarManager
.fill
in interface IContributionItem
parent
- the parent cool barindex
- the index where the controls are inserted,
or -1
to insert at the endpublic void fill(Menu parent, int index)
IContributionItem
MenuManager
.fill
in interface IContributionItem
parent
- the parent menuindex
- the index where the controls are inserted,
or -1
to insert at the endpublic void fill(ToolBar parent, int index)
IContributionItem
ToolBarManager
.fill
in interface IContributionItem
parent
- the parent tool barindex
- the index where the controls are inserted,
or -1
to insert at the endpublic IContributionItem find(String id)
find
in interface IContributionManager
find
in class SubContributionManager
id
- of the IContributionItem
null
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 IMenuManager
path
- 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)
findUsingPath
in interface IMenuManager
path
- which allows to find an IContributionItem
through the
menu structure.null
if there is no
such contribution itempublic String getId()
IContributionItem
getId
in interface IContributionItem
null
if noneprotected final IMenuManager getParentMenuManager()
public boolean getRemoveAllWhenShown()
IMenuManager
false
.getRemoveAllWhenShown
in interface IMenuManager
true
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.
mgr
- the menu manager to be wrappedpublic boolean isDynamic()
IContributionItem
isDynamic
in interface IContributionItem
true
if this item is dynamic, and
false
for normal itemspublic boolean isEnabled()
IMenuManager
isEnabled
in interface IContributionItem
isEnabled
in interface IMenuManager
true
if enabled, and
false
if disabledpublic boolean isGroupMarker()
IContributionItem
isGroupMarker
in interface IContributionItem
true
if this item is a group marker, and
false
for normal itemsGroupMarker
,
IContributionManager.appendToGroup(String, IContributionItem)
,
IContributionManager.prependToGroup(String, IContributionItem)
public boolean isSeparator()
IContributionItem
isSeparator
in interface IContributionItem
true
if this item is a separator, and
false
for normal itemsSeparator
public void removeAll()
removeAll
in interface IContributionManager
removeAll
in class SubContributionManager
public void removeMenuListener(IMenuListener listener)
IMenuManager
removeMenuListener
in interface IMenuManager
listener
- the menu listenerpublic void saveWidgetState()
IContributionItem
saveWidgetState
in interface IContributionItem
public void setParent(IContributionManager parent)
IContributionItem
setParent
in interface IContributionItem
parent
- the parent contribution managerpublic void setRemoveAllWhenShown(boolean removeAll)
IMenuManager
setRemoveAllWhenShown
in interface IMenuManager
removeAll
- true
if all items should be removed when shown,
false
if notpublic void setVisible(boolean visible)
SubContributionManager
true
then each item within the manager appears within the parent manager.
Otherwise, the items are not visible.setVisible
in interface IContributionItem
setVisible
in class SubContributionManager
visible
- the new visibilitypublic void update()
IContributionItem
update
in interface IContributionItem
public void update(boolean force)
IContributionManager
update
in interface IContributionManager
force
- true
means update even if not dirty,
and false
for normal incremental updatingpublic void update(String id)
IContributionItem
update
in interface IContributionItem
id
- the id of the changed propertypublic void updateAll(boolean force)
IMenuManager
updateAll
in interface IMenuManager
force
- true
means update even if not dirty,
and false
for normal incremental updatingprotected SubMenuManager wrapMenu(IMenuManager menu)
menu
- the menu manager to wrap
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.