|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.action.ContributionManager | +--org.eclipse.jface.action.MenuManager
A menu manager is a contribution manager which realizes itself and its items in a menu control; either as a menu bar, a sub-menu, or a context menu.
This class may be instantiated; it may also be subclassed.
Constructor Summary | |
MenuManager()
Creates a menu manager. |
|
MenuManager(String text)
Creates a menu manager with the given text. |
|
MenuManager(String text,
String id)
Creates a menu manager with the given text and id. |
Method Summary | |
void |
addMenuListener(IMenuListener listener)
Adds a menu listener to this menu. |
Menu |
createContextMenu(Control parent)
Creates and returns an SWT context menu control for this menu, and installs all registered contributions. |
Menu |
createMenuBar(Decorations parent)
Creates and returns an SWT menu bar control for this menu, for use in the given Decorations , and installs all registered
contributions. |
Menu |
createMenuBar(Shell parent)
Deprecated. use createMenuBar(Decorations) instead. |
void |
dispose()
Disposes of this menu manager and frees all allocated SWT resources. |
void |
fill(Composite parent)
Fills the given composite control 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. |
IMenuManager |
findMenuUsingPath(String path)
Finds the manager for the menu at the given path. |
IContributionItem |
findUsingPath(String path)
Finds the contribution item at the given path. |
String |
getId()
Returns the menu id. |
Menu |
getMenu()
Returns the SWT menu control for this menu manager. |
String |
getMenuText()
Returns the text shown in the menu. |
IContributionManagerOverrides |
getOverrides()
Returns the overrides for the items of this manager. |
IContributionManager |
getParent()
Returns the parent contribution manager of this manger. |
boolean |
getRemoveAllWhenShown()
Returns whether all items should be removed when the menu is first shown, but before notifying menu listeners. |
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. |
boolean |
isSubstituteFor(IContributionItem item)
|
boolean |
isVisible()
Returns whether this contribution item is visibile within its manager. |
void |
removeMenuListener(IMenuListener listener)
Removes the given menu listener from this menu. |
void |
setOverrides(IContributionManagerOverrides newOverrides)
Sets the overrides for this contribution manager |
void |
setParent(IContributionManager manager)
Sets the parent manager of this item |
void |
setRemoveAllWhenShown(boolean removeAll)
Sets whether all items should be removed when the menu is first shown, but before notifying menu listeners. |
void |
setVisible(boolean visible)
Sets whether this contribution item is visibile within its 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)
The MenuManager implementation of this IContributionManager
updates this menu, but not any of its submenus. |
protected void |
update(boolean force,
boolean recursive)
Incrementally builds the menu from the contribution items. |
void |
update(String property)
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. |
Methods inherited from class org.eclipse.jface.action.ContributionManager |
add, add, appendToGroup, appendToGroup, dumpStatistics, find, getItems, hasDynamicItems, indexOf, insert, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, itemAdded, itemRemoved, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll, setDirty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.eclipse.jface.action.IContributionManager |
add, add, appendToGroup, appendToGroup, find, getItems, insertAfter, insertAfter, insertBefore, insertBefore, isDirty, isEmpty, markDirty, prependToGroup, prependToGroup, remove, remove, removeAll |
Methods inherited from interface org.eclipse.jface.action.IContributionItem |
isDirty |
Constructor Detail |
public MenuManager()
null
.
Typically used for creating a context menu, where it doesn't need to be referred to by id.public MenuManager(String text)
null
.
Typically used for creating a sub-menu, where it doesn't need to be referred to by id.text
- the text for the menu, or null
if nonepublic MenuManager(String text, String id)
text
- the text for the menu, or null
if noneid
- the menu id, or null
if it is to have no idMethod Detail |
public void addMenuListener(IMenuListener listener)
IMenuManager
addMenuListener
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
listener
- a menu listenerpublic Menu createContextMenu(Control parent)
Note that the menu is not expected to be dynamic.
parent
- the parent controlpublic Menu createMenuBar(Decorations parent)
Decorations
, and installs all registered
contributions. Does not create a new control if one already exists.parent
- the parent decorationspublic Menu createMenuBar(Shell parent)
createMenuBar(Decorations)
instead.
Shell
, and installs all registered contributions. Does not
create a new control if one already exists. This implementation simply calls
the createMenuBar(Decorations)
methodparent
- the parent decorationspublic void dispose()
removeAll
for that purpose.dispose
in interface IContributionItem
public void fill(Composite parent)
IContributionItem
StatusLineManager
.fill
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
parent
- the parent controlpublic void fill(Menu parent, int index)
IContributionItem
MenuManager
.fill
in interface IContributionItem
org.eclipse.jface.action.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
org.eclipse.jface.action.IContributionItem
parent
- the parent tool barindex
- the index where the controls are inserted,
or -1
to insert at the endpublic IMenuManager findMenuUsingPath(String path)
IMenuManager
'/'
.
Convenience for findUsingPath(path)
which
extracts an IMenuManager
if possible.
findMenuUsingPath
in interface IMenuManager
org.eclipse.jface.action.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)
IMenuManager
'/'
.findUsingPath
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
path
- the path stringnull
if there is no
such contribution itempublic String getId()
getId
in interface IContributionItem
public Menu getMenu()
public String getMenuText()
public IContributionManagerOverrides getOverrides()
IContributionManager
getOverrides
in interface IContributionManager
getOverrides
in class ContributionManager
org.eclipse.jface.action.IContributionManager
public IContributionManager getParent()
public boolean getRemoveAllWhenShown()
IMenuManager
false
.getRemoveAllWhenShown
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
true
if all items should be removed when shown, false
if notpublic boolean isDynamic()
IContributionItem
isDynamic
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
true
if this item is dynamic, and
false
for normal itemspublic boolean isEnabled()
The default implementation of this framework method
returns true
. Subclasses may reimplement.
isEnabled
in interface IMenuManager
true
if enabled, and
false
if disabledpublic boolean isGroupMarker()
IContributionItem
isGroupMarker
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
true
if this item is a group marker, and
false
for normal itemsGroupMarker
,
IContributionManager.appendToGroup(java.lang.String, org.eclipse.jface.action.IAction)
,
IContributionManager.prependToGroup(java.lang.String, org.eclipse.jface.action.IAction)
public boolean isSeparator()
IContributionItem
isSeparator
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
true
if this item is a separator, and
false
for normal itemsSeparator
public boolean isSubstituteFor(IContributionItem item)
public boolean isVisible()
IContributionItem
isVisible
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
true
if this item is visible, and
false
otherwisepublic void removeMenuListener(IMenuListener listener)
IMenuManager
removeMenuListener
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
listener
- the menu listenerpublic void setRemoveAllWhenShown(boolean removeAll)
IMenuManager
setRemoveAllWhenShown
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
removeAll
- true
if all items should be removed when shown, false
if notpublic void setVisible(boolean visible)
IContributionItem
setVisible
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
visible
- true
if this item should be visible, and
false
otherwisepublic void setOverrides(IContributionManagerOverrides newOverrides)
setOverrides
in class ContributionManager
newOverrides
- the overrides for the items of this managerpublic void setParent(IContributionManager manager)
IContributionItem
setParent
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
parent
- the parent contribution managerpublic void update()
IContributionItem
update
in interface IContributionItem
public void update(boolean force)
MenuManager
implementation of this IContributionManager
updates this menu, but not any of its submenus.update
in interface IContributionManager
updateAll(boolean)
public void update(String property)
IContributionItem
update
in interface IContributionItem
org.eclipse.jface.action.IContributionItem
String
- id the di of the changed propertyprotected void update(boolean force, boolean recursive)
force
- true
means update even if not dirty,
and false
for normal incremental updatingrecursive
- true
means recursively update
all submenus, and false
means just this menupublic void updateAll(boolean force)
IMenuManager
updateAll
in interface IMenuManager
org.eclipse.jface.action.IMenuManager
force
- true
means update even if not dirty,
and false
for normal incremental updating
|
Eclipse Platform 2.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |